Bug Script Menu

fronobulax

Developer
Staff member
1620308678076.png

Menu is unusable :)

Character has scriptMRULength set to 40 and 26 slots are used.

Haven't seen it on characters with length set to 30 but they are not using all 30 slots either.

Can't consistently reproduce but trying to view the menu while a script is adventuring seems to be a trigger. Once it happens it stays that way until KoLmafia is restarted.

Before the scrolling changes it was possible to get the menu to display but not allow items to be selected from it during adventuring so this may be a new manifestation of a pre-existing bug.

The desired number of items to display is hardwired to 25. I think I would prefer it to be scriptMRULength I am not quite prepared to impose that on everyone yet :)
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Can't consistently reproduce but trying to view the menu while a script is adventuring seems to be a trigger. Once it happens it stays that way until KoLmafia is restarted.
Oh no they chonky - looking into it.
The desired number of items to display is hardwired to 25. I think I would prefer it to be scriptMRULength I am not quite prepared to impose that on everyone yet :)
I considered this but thought that MRU would be misleading.
 

fronobulax

Developer
Staff member
My play workflow, and laptop resolution have conspired to make the scriptMRUList a wonderful helper. It serves as a check list for what I do daily and a reminder of how I do things occasionally. My goal would be to maximize the number of entries that are on the screen without scrolling. Right now my choice would be 26 and I realize that is based upon my screen resolution and not the MRU list length, as such. Basically in "normal" times a day's play results in 26 entries.

I'm pretty sure the "cost" (in terms of programmer effort) of trying to calculate a maximum window size is too high for the benefit.

So the simple options include
  • changing 25 to 26 and hoping no one else knows or cares
  • making a user preference, that defaults to 25, and using the preference.
  • me changing how my scripts call and include each other so that my daily becomes 25
As I think it through what I want is my daily used scripts on screen without scrolling and that number is almost always less that the script MRU length.

I think people that have the script MRU length set to zero probably don't care :)
 

fronobulax

Developer
Staff member
Can't for the life of me reproduce this!

I'll keep trying then. When I see the other, "frozen" problem I am usually running one script and realized I want to queue up something to follow it. The running script usually is adventuring. My often dicey intuition wonders about something running on the Swing thread that shouldn't but...
 

Malibu Stacey

Active member
This might be JVM caused. Katarn was having issues with scrolling the menu with his scroll wheel on some version of the Oracle JDK. He installed AdoptOpenJDK 11 & it fixed.

I've also had scaling issues with the mafia dialogs in Oracle JDK on Windows 10 (as in, when I launched it some days it would be scaled correctly others it would not and I would have to squint at my screen) which also hasn't happened since I switched to AdoptOpenJDK 11.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
It would be good to get a general reading of whether this has been a welcome change or not, I can always roll it back
 

fronobulax

Developer
Staff member
I'm all right with the change in general. I'd rather squash the bugs than revert it. When 25 vs. 26 bothers me I know how to fix it....

My attempt to reproduce seems to be to run a long script that adventures and press the Scripts button as often as I have patience for. I couldn't reproduce it today but I did get the MRU menu in a state where I ran a script and it was not added to the list.

I can easily construct a fantasy where the MRU list is being updated and something else is trying to render the menu and the results are not pretty. I'm going to perform some local experiments with synchronization.
 

ckb

Minion
Staff member
Can't for the life of me reproduce this!
I can!
r20715, Windows 10, Java Version 8 Update 291

Set scriptMRULength=0, everything looks normal.
Set scriptMRULength=X, where X>1, then choose 'Refresh Menu', then everything looks chunky. Mine are even chunkier than Frono's image above.

I will also note that scriptMRUList=""
 

Malibu Stacey

Active member
It would be good to get a general reading of whether this has been a welcome change or not, I can always roll it back
Personally, as someone who often prunes the stuff inhabiting their scripts directory to alleviate the menu going off the bottom of the screen I'm all for it.
 

fronobulax

Developer
Staff member
As an update, my original implementation made a couple of choices that were not thread friendly. I have cleaned them up and am running with them to decide whether I really need to make them thread safe or not. I have seen cases where the menu does not update although the preference does and @ckb 's recipe does generate something that should/could be fixed. I think there might be two issues - one is that the the displayed menu does not reflect the state of the preference and the other is that the displayed menu is not built correctly which could be a data issue or something else.

I like the change. The most I would do would be to change the number of lines displayed and I might get used to 25 while trying to solve the other issues. I think the update issue existed before the change but I am absolutely certain @gausie will assist if I find something that could be improved in the scrolling code.

Thanks for chiming in.
 

fronobulax

Developer
Staff member
r20735 makes ScriptMRU use an Iterator. If there is a multithreading problem using an Iterator is part of the solution to making things thread safe.

That said, I'm currently not convinced that the menu is rebuilt under all the conditions where it might change so there is still an investigation going on.
 
Top