GameInform Dungeon script

caphector

Member
I'm a bit behind the curve with this but I'd like to automate the GameInform dungeon. Unfortunately, the existing scripts don't work anymore and I'd like to fix it. Currently, they'll adventure until the first floor is done and then fail to go further. Mafia will prompt that "You have already cleared the area" but the script doesn't continue.

Levels 1 and 2, when cleared, gives this message: "You already cleared out this area.". Is there a way to catch that response and tell the script to go to the next level of the dungeon? The only way I can think of is to create a matcher and check after each adventure. I'm pretty sure there's a better way to check if the next level is open but I'm not sure what it is.

The script I'm currently using is this:

Code:
import <zlib.ash>;

item walkthru = $item[GameInformPowerDailyPro walkthru];
item magazine = $item[GameInformPowerDailyPro magazine];
void DailyPro()
{
        while(my_adventures()>30)
        {
                cli_execute("inv refresh");
                if (item_amount(walkthru) == 0)
                {
                        if (item_amount(magazine) == 0)
                        {
                                buy(1, magazine);
                        }

                        visit_url("inv_use.php?pwd&whichitem=6174&confirm=Yep.");
                        cli_execute("inv refresh");
                }

                if (item_amount(walkthru) == 0)
                {
                        abort("Failed to use a " + magazine );
                }

                adventure( my_adventures(), $location[Video Game Level 1] );
                adventure( my_adventures(), $location[Video Game Level 2] );
                while ( my_adventures() > 0 )
                {
                        adv1($location[Video Game Level 3], -1, "");
                        if (get_property("lastEncounter") == "A Gracious Maze")
                        {
                                visit_url("place.php?pwd&whichplace=faqdungeon");
                        }
                        else if (get_property("lastEncounter") == "")
                        {
                                break;
                        }
                }
        }
}

void main()
{
        DailyPro();
}
 

AlbinoRhino

Active member
I wrote a script for this as well. I believe I ended up using "try ... finally" to bypass the error state when a level is cleared.



Code:
    //try ... finally will continue beyond an error state
    try
    {
        while ( my_adventures() > 0 )
        {
            adv1($location[Video Game Level 1], -1, "");
        }
    }
    finally
    {
        try
        {
            while ( my_adventures() > 0 )
            {
                adv1($location[Video Game Level 2], -1, "");
            }
        }
        finally
        {
            while ( my_adventures() > 0 )
            {
                adv1($location[Video Game Level 3], -1, "");
                if (get_property("lastEncounter") == "A Gracious Maze")
                {
                    print("Gracious Maze detected. Visiting dungeon page ...","blue");
                    visit_url("place.php?pwd&whichplace=faqdungeon");
                }
            }
        }
    }
 
Last edited:

Crowther

Active member
Someone correct me if I'm wrong (has that ever been an issue?), but I believe you two simply need to capture the return value from adventure() or adv1(). If a boolean function returns false and you can't use it, your script aborts. Instead, assigned it to a variable or use it in a conditional. That would make some simple code. I really don't like the try/finally embedded inside a finally scope. Normally finally is used for a quick clean up and then things move on.
 

AlbinoRhino

Active member
Sounds sensible. I got the cubeling and will probably never use the script again, so I probably won't be trying it this way. But thanks for the advice just the same. Never know when I might run into a similar issue somewhere else !
 

chown

Member
Neither try-finally nor return values alone are able to distinguish the reason why adv1 did not spend any adventures. It could be that a timer expired, (well, if you aren't ignoring them entirely) you could be at 0 HP or drunk, or you might not have that area open. (And maybe there are other cases, too. Those are just ones that immediately spring to mind.)

At the cost of one request to KoL, you can check which stage is currently available, and at least rule that out as a reason. Something like:

Code:
matcher m = create_matcher(
    "snarfblat=(.[^>]*)>",
    visit_url("place.php?whichplace=faqdungeon"));
if (!find(m)) abort("The GameInformPowerDailyPro dungeon is not open.");
int level = to_int(m.group(1)) - 318;  // 1, 2, or 3, as appropriate
location currentFaqLocation = to_location(to_int(m.group(1)));  // or, just use that.
 
Top