Feature - Implemented Make Script Hooks visible in Preferences

Bale

Minion
Since Hola made that nice preferences dialogue to make our preferences less confusing, it would be good if a section was added for script hooks. Every now and then someone says that they don't know what scripts might be running between adventures and we tell them a set of preferences to check. That's definitely more confusing than it should be.

After "External Programs" there should be a section called "External Scripts" laid out like the "Login and Logout" section. It should contain the following:


Adventuring Scripts:
Recovery (recoveryScript)
Before Adventure (betweenBattleScript)
After Adventure (afterAdventureScript)
Counter Script (counterScript)

Ascension Preparation:
Breaking the Prism (kingLiberatedScript)
Post-Ascension (postAscensionScript)
Pre-Ascension (preAscensionScript)

Miscellaneous:
Before PvP (beforePVPScript)
Buying (buyScript)
Planting (plantingScript)
Chatbot (chatbotScript)
Login (loginScript)
Logout (logoutScript)
 

Veracity

Developer
Staff member
Without speaking to the exact details/layout you propose, I wholeheartedly approve of the general proposal. I've wanted this myself for a long time.
 

roippi

Developer
What'd hola do to preferences? Either I'm blanking or I missed the commit you're referring to.
 

Veracity

Developer
Staff member
He put them into a CardLayout, rather than on Tabs, and moved individual settings around to suit his taste.
 

Catch-22

Active member
I started looking into this and I realized the "login/logout" panel is already called "ScriptPanel" internally. Would it perhaps be a better idea to have all the scripts on one panel? ie. add your suggestions to the "Login/Logout" panel and then give it a more meaningful title?

Perhaps instead of "Login and Logout" it could be titled "Automation" or something along those lines.

Adding a new panel is easy enough though, but I just figured I would ask if it's worthwhile consolidating them all into the existing panel.
 

Veracity

Developer
Staff member
One thing to keep in mind for this: The "Script Hooks" are actually "a single line to pass to the CLI to execute at appropriate times". They do NOT have to be a "script file". For example, when I was debugging the before and after adventure script settings, I set the former to "print About to adventure!" and the latter to "print Just ran an adventure!". I envision having a little text block big enough to hold several lines, but restricted to a single line with line wrapping, as needed, and, perhaps, also a button on the right to go to a "select file" dialog which will find a file relative to "scripts" and enter the name of the file into the box when you navigate to and select a script file. So, I could either enter "CounterChecker.ash" into the box or browse to find it in my scripts folder.
 

Veracity

Developer
Staff member
Well, OK. That's acceptable - and is all you need if you are actually using a filename as a "script". But, as I said, each "script" is actually a "line of text interpreted by the CLI". Which is to say, a CLI command. The names of script files work as CLI commands. However, the following is also a "script":

print "I just finished an adventure. Yeah! I am awesome!"; print "Did I say how awesome I am?"; print "Awesome, sister, awesome."

Or, perhaps more realistically, what I used for SSPD back in the day:

ashq item it = $item[ tattered paper crown ]; if ( item_amount( it ) > 0 && !have_equipped( it ) ) equip( it );

It would be nice if that little text box was bigger and if I type in 200 characters, say, there is room to see 200 characters, wrapped at the right border, rather than simply truncated, which makes it darned hard to edit; you have to drag with the mouse until the part you want to modify is visible, click and enter new text, select and delete, what have you - all inside a little window into the line.
 

roippi

Developer
I figured that could be a separate freq since that problem already exists with the login/logout fields.

(I am stealing that afterAdventureScript :p)
 

Catch-22

Active member
It would be nice if that little text box was bigger and if I type in 200 characters, say, there is room to see 200 characters, wrapped at the right border, rather than simply truncated, which makes it darned hard to edit; you have to drag with the mouse until the part you want to modify is visible, click and enter new text, select and delete, what have you - all inside a little window into the line.

Yeah I was planning on looking into making it easier to type lines into at a later stage, I agree that a truncating textbox in any application is incredibly annoying. For now it works though and I think people should be encouraged to place their automation actions in an ASH file once it gets longer than a few hundred characters anyway.
 

roippi

Developer
It would be nice if that little text box was bigger and if I type in 200 characters, say, there is room to see 200 characters, wrapped at the right border, rather than simply truncated, which makes it darned hard to edit; you have to drag with the mouse until the part you want to modify is visible, click and enter new text, select and delete, what have you - all inside a little window into the line.

r11193 should do that in a moderately flashy manner.
 

Veracity

Developer
Staff member
Oh, that is impressive. Some observations on the Automation panel:

- It is slightly wider than before. Therefore, when I open it up, with my Standard-sized Adventure Frame, each of the little text box widgets goes to the right border - and I have to manually widen the whole frame in order to see the File Selection control.
- I do so, and I see these little triangles pointing down to the left of all the text boxes. I click on the one for On Login, and the triangle points right - and the File Selection gets 3 or 4 times as tall. I can click repeatedly on the triangle/arrow and it points down/right/down/right/... and the space grows and shrinks and grows and shrinks - but it never shrinks back down to the original height, even with nothing in the text box.
- OK, now I am clicking on this triangle and that one, with no text in the text boxes, and am watching space for particular scripts growing and shrinking. I'm not sure exactly what is happening.

This is definitely promising, but the repacking is behaving slightly weirdly.

You have definitely passed me in Swing expertise. I was hoping you would pick up my comment and run with it, and you did so.

Maybe you can investigate some of the other Swing challenges we/I have had. ;)

- Make the "container" drop down on the Gear Changer be visible or not visible depending on whether you have a container in inventory.
- If your offhand item is a "card sleeve", add a new drop down for showing/selecting cards - perhaps with tooltips or something showing the Enchantment
- And what about the issue with "Outfits and Familiars take effect immediately in the Gear Changer" - which I like, but which, as coded, makes it impossible to open the drop down, scroll around within it using keys, and only execute the change when you exit the drop down and close it?

Maybe I should write Feature Requests for all of those and hang special Roippi Bait on them. :)

Thanks again.
 

roippi

Developer
Yeah, there are probably still some ways to break it by toggling when it is just a single line. Though I can't really replicate your behavior on my L&F, which is troubling for debugging purposes.

Does it behave rationally if you add some lines to it first and then collapse/expand?

Edit: okay, I think I might have a way to replicate this. There's an issue with how resizing of the window plays with the collapsing function. So I suppose first patch is to not make resizing of the window necessary.
 
Last edited:
Top