First (real) attempt to make an ash script: Sewer.ash

slyz

Developer
You define the run_choice() function, but never actually call it. That's what is causing the script to loop during the repeat, when you encounter a choice adventure.

Another problem is that, inside the run_choice() function, the "sewers" variable should be "page_text".

If you remove run_choice() from the repeat{} structure, and place it at the top level instead (anywhere in the script that isn't inside another function), you need to call it in the repeat{} just like you call run_combat().

The result of visit_url() should also be stored in the sewers variable, since you need to check for the string "combat" in the most recent page you visited, not in the first page you visited. This is what the repeat{} should look like:
PHP:
repeat 
    {
    // adventure in sewers
    sewers = visit_url("adventure.php?snarfblat=166") ;
    // if it's a combat adventure, obey the custom combat script
    if (contains_text( sewers , "combat"))
        run_combat();
    // handles choice adventures
    sewers = run_choice( sewers );
    }
until (contains_text( sewers ,"onward and... downward!")) ;

This should make the script run stop looping, at least.
 

me259259

Member
Rise thread! Rise from the ashes to serve me! BWA HA HA HA HA!

Interesting note, a little while ago, sewer.ash stopped changing your mood. Here's what I had:

PHP:
set_property ("currentMood" , sewerTude);

The thing that confuses me is that the script did change your currentMood property in your preferences, but it did not actually change your mood while adventuring. Right now I fixed it by invoking the cli mood manager. Any idea why the above didn't work?
 

Bale

Minion
It's probably connected to the fact that changing your mood with set_property() won't update the GUI.
 

me259259

Member
Hmm... I can understand if it didn't update the GUI, but I would have thought that mafia would still execute the mood in your preferences. It's not as if the mood in your preferences changes to match the GUI one if there is a conflict (unless you change the GUI mood). Using set_property sets the mood, the mood is changed in the preferences, but the executed mood is the GUI mood, and the preference'd mood never changes back to the GUI mood (unless you change it in the GUI). Does this property only say what mood you're using, and does not actually handle your mood? I think I was confused because you can use set_property to change your combat script, which updates the GUI and works fine.

Is there a better way to handle switching moods than by using a cli_execute?
 

jasonharper

Developer
You can change your CCS via a preference only because somebody wrote some code to detect that specific preference being changed, and update the GUI accordingly. There's no equivalent code for setting your mood via a preference, and no reason for anybody to write such code since there's already a CLI "mood" command that does all the necessary work.
 

Bale

Minion
So, we can simply say that this is caused by the lack of a feature. :) Please use the CLI command.
 
Top