Bug - Not A Bug Llama gong choice advs - setting from .ash script not reflected in gCLI

antimarty

Member
I have a moleform .ash script that sets the llama gong choice adv:
Code:
set_property("choiceAdventure276","2");

After I run the script, the Choice Advs selector in the GUI will still show the previous setting, e.g. "myst, myst, +30ML", even though a "use 1 llama gong" gCLI command will actually invoke the moleform setting. This persists even after exiting mafia; to clear it I have to change the setting in the GUI to something else, and then back to what I want.

I didn't check whether something similar happens with other item choices.
 

lostcalpolydude

Developer
Staff member
I believe this happens with all Item and Adventure choices, though the part where it persists through closing mafia seems different. I'm pretty sure there are similar threads to merge this with, but I wasn't able to find one.
 

roippi

Developer
line 319 of ChoiceOptionsPanel does

Code:
		PreferenceListenerRegistry.registerListener( "choiceAdventure*", this );

which doesn't appear to be working with the wildcard. A quick fix would be to just iterate over all the choiceAdventures and individually register listeners for each one, but perhaps there's a better way.
 

slyz

Developer
Why isn't it working?

Preferences.setObject() has:
Code:
if ( name.startsWith( "choiceAdventure" ) )
{
	PreferenceListenerRegistry.firePreferenceChanged( "choiceAdventure*" );
}
so ChoiceOptionsPanel.update() should be called whenever any of the choiceAdventureXXX preferences is changed.


EDIT: If I change one of the choiceAdventureXXX settings, I see the updated choice in the Choice Advs tab. I'll check how it works for gongs specifically though.
 
Last edited:

slyz

Developer
The selector for "Llama gong" in the Choice Advs panel is controlled by the "gongSelect" preference, that's why the choice wasn't updated when you did
PHP:
set_property("choiceAdventure276","2");

If you want to choose gongPath yourself, simply find the right number here:
Code:
0  : "show in browser",
1  : "bird",
2  : "mole",
3  : "roach (in browser)",
4  : "musc, musc, +30% musc",
5  : "musc, mox, +30% musc",
6  : "musc, MP, +30% musc",
7  : "myst, musc, +30% myst",
8  : "myst, myst, +30% myst",
9  : "myst, MP, +30% myst",
10 : "mox, myst, +30% mox",
11 : "mox, mox, +30% mox",
12 : "mox, MP, +30% mox",
13 : "musc, musc, +10% all",
14 : "myst, musc, +10% all",
15 : "musc, mox, +10% all",
16 : "myst, myst, +10% all",
17 : "mox, mox, +10% all",
18 : "mox, MP, +10% all",
19 : "musc, musc, +50% items",
20 : "myst, musc, +50% items",
21 : "musc, MP, +50% items",
22 : "mox, myst, +50% items",
23 : "myst, MP, +50% items",
24 : "mox, MP, +50% items",
25 : "musc, mox, +30 ML",
26 : "musc, MP, +30 ML",
27 : "myst, myst, +30 ML",
28 : "mox, myst, +30 ML",
29 : "myst, MP, +30 ML",
30 : "mox, mox, +30 ML",

In your script, replace the set_property() by:
PHP:
set_property("gongPath","2");
or by
PHP:
cli_execute("gong mole");
 
Top