Bug JavaScript bugs

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Tour Guide, available from https://github.com/cdrock/TourGuide/branches/Release installs both relay_TourGuide.ash and relay_TourGuide.js in /relay.

This results in two entries labelled TourGuide in the relay browser run script dropdown. While the author could have made different choices this raises the question of how to handle similarly named scripts? Since an ash script and a js script are two different things, I think there is a feature request to distinguish between the two types in menus.

And, when I run relay_TourGuide.jsI I get
JavaScript evaluator exception: syntax error (file:/D:/Dropbox/dist/relay/relay_TourGuide.js#555)
and at this point I cannot tell whether that is a scripting error or an implementation error so am reporting it here.
Now that we support JS, relay_ should be reserved for scripts that are to be executed by the mafia interpreter not the browser. The feature request should be to rename relay_TourGuide.js to TourGuidIne.js or similar
 

fronobulax

Developer
Now that we support JS, relay_ should be reserved for scripts that are to be executed by the mafia interpreter not the browser. The feature request should be to rename relay_TourGuide.js to TourGuidIne.js or similar

I'm not quite following you.
 

lostcalpolydude

Developer
Now that we support JS, relay_ should be reserved for scripts that are to be executed by the mafia interpreter not the browser. The feature request should be to rename relay_TourGuide.js to TourGuidIne.js or similar
I'm pretty sure the main purpose of pretending relay_ is to make it show in the "run script" dropdown, specifically to be able to run it in the browser. Or at least that has been the purpose for the last 10+ years.

The actual report there seems to be that this dropdown strips the file extension, which is relevant now that there are two possible file extensions and duplicates are possible (thanks to 20523).
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
I'm pretty sure the main purpose of pretending relay_ is to make it show in the "run script" dropdown, specifically to be able to run it in the browser. Or at least that has been the purpose for the last 10+ years.
No this isn't correct. relay_ scripts are executed by the mafia interpreter when selected from the "run script" dropdown and any output from write or similiar is rendered in the browser.

I am certain that relay_TourGuide.js was at no point intended to be shown in the dropdown, so the immediate solution is for the developers to update their package for compatiblity with the current revision of mafia.

In the future we could have an issue where two scripts genuinely want to show up in the "run script" dropdown and have the same filename and a different extension. I agree we should find some way to disambiguate that but its definitely not something that is likely to ever happen except by mistake!
 
Looks like @fredg1 (most active contributor of the TourGuide fork) has already renamed relay_TourGuide.js. They just haven't released it yet.

Fred, if you see this, may we ask for a mini-release that contains the rename? I for one keep getting confused which "TourGuide" is the correct one in the relay scripts menu.

Edit: The latest release has fixed it. Thank you!
 
Last edited:

fronobulax

Developer
Whether relay_TourGuide.js was intended to show up in the relay script menu, or not, it did and that points out that KoLmafia only displays a portion of the pathname in menus. An easy solution would be to include the extension in the menu entry. A less cluttered solution might be to break the menu into two sections - ash and js - and use menu position to disambiguate for the user. Whatever we decide for the relay script menu is likely to be considered for the ScriptMRU list as well.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Whether relay_TourGuide.js was intended to show up in the relay script menu, or not, it did and that points out that KoLmafia only displays a portion of the pathname in menus. An easy solution would be to include the extension in the menu entry. A less cluttered solution might be to break the menu into two sections - ash and js - and use menu position to disambiguate for the user. Whatever we decide for the relay script menu is likely to be considered for the ScriptMRU list as well.
This isn't an actual problem, as I explained here. If anyone has the time and the inclination (i.e. not me right now) the best solution would be to append the extension to (and only to) any clashing select options.
In the future we could have an issue where two scripts genuinely want to show up in the "run script" dropdown and have the same filename and a different extension. I agree we should find some way to disambiguate that but its definitely not something that is likely to ever happen except by mistake!
 

xKiv

Active member
This isn't an actual problem, as I explained here. If anyone has the time and the inclination (i.e. not me right now) the best solution would be to append the extension to (and only to) any clashing select options.
I thought that you can have multiple copies of relay_X.ash *and* relay_X.js throughout the relay/*/ hierarchy and the dropdown would display all of them (without paths), but only the relay/ directory itself seems to be scanned for that purpose. This means that you are right for the browser dropdown - showing the extension for clashing options would help resolve clashes.
It is also enough for the script menu in mafia, because that has submenus for subdirectories.

I can't tell if MRU stores scripts with extensions.
 
Top