Free Fights Script

Pazleysox

Member
I wrote a free fights script long ago, but it gets stuck in the red zeppelin. Can someone point me in the direction of what I might have missed/mixed up here?

Code:
    string zep = visit_url("place.php?whichplace=zeppelin");
    if (zep.contains_text("The Red Zeppelin"))
    {
        if ($item[Red Zeppelin ticket].to_int() < 1)
            {
            retrieve_item(1, $item[Red Zeppelin ticket]);
            }
    if (get_property("_glarkCableUses").to_int() < 5) 
        {
        void get_it (item thing, int amount) 
            {
            int have = item_amount(thing);
            int need = max(0, amount-have);
            if (need == 0) 
                {
                return;
                }
            cli_execute("find "+amount+" "+thing);
            }
        get_it($item[glark cable], 5);
        }
    while (get_property("_glarkCableUses").to_int() < 5)
        {
        adv1($location[The Red Zeppelin], -1, "");
        }
    }

    if (get_property("_lynyrdSnareUses").to_int() < 3) 
        {
        void get_it (item thing, int amount) 
            {
            int have = item_amount(thing);
            int need = max(0, amount-have);
            if (need == 0) 
                {
                return;
                }
            cli_execute("find "+amount+" "+thing);
            }
        get_it($item[lynyrd snare], 3);
        }
    while (get_property("_lynyrdSnareUses").to_int() <3)
        {
        cli_execute("use lynyrd snare");
        run_combat();
        }
 

Rinn

Developer
$item[Red Zeppelin ticket].to_int() returns the item id, not the number in your inventory. You want .item_amount()
 

Rinn

Developer
Also those get_it functions are unnecessary, retrieve_item counts items in your inventory already when determining how many to acquire.
 

ckb

Minion
Staff member
What Rinn said.
Here is a simplified code that should work (untested).


Code:
if ($strings[step3,step4,finished] contains get_property("questL11Ron"))
{
    retrieve_item(1,$item[Red Zeppelin ticket]);
    if (get_property("_glarkCableUses").to_int() < 5)
    {
        retrieve_item(5,$item[glark cable]);
        while (get_property("_glarkCableUses").to_int() < 5)
        {
            adv1($location[The Red Zeppelin], -1, "");
        }
    }
}

if (get_property("_lynyrdSnareUses").to_int() < 3)
{
    retrieve_item(3,$item[lynyrd snare]);
    while (get_property("_lynyrdSnareUses").to_int() <3)
    {
        use(1,$item[lynyrd snare]);
    }
}
 

Pazleysox

Member
Here is a simplified code that should work (untested).

This worked just fine. I suppose the issue is with my custom combat. It uses:
"red"
"item glark cable"

Once I added the specific monster names, the script works just fine. Thanks for the help!
 
Top