Any script requests?

Bale

Minion
Hyboria would be a chore to write. A ton of choiceAdventure settings to research, some of which actually change options depending on progress, not to mention if you try to auto-adventure with a choiceadv as a goal, you don't know if it stopped due to using up your adventures for that bottle or successfully finding the choiceadv. I think I saw someone else asking about handling changing choiceadventures for this exact purpose... wonder if they got it figured out or not.

The only way to do Hyboria would be to modify Alhifar's run_adv() function to search for patterns of text and answer the choice according to the response. It sounds rather time consuming, but interesting. Well, the basic work sounds interesting. It will soon turn into a tedious chore when you're adding in the recognition pattern for the 15th choice adventure...

His function is very flexible. I'm using a variation of it for CounterChecker where it answers the wormwood choice adventures based on my goal, ignoring my choiceadventure preferences.
 
Last edited:

Rinn

Developer
Or you can do everything manually:

THIS WILL NOT WORK CORRECTLY IF YOU HAVE ALREADY MADE SOME PROGRESS IN THE HYBORIA QUEST THAT WASN'T ACCOMPLISHED USING THIS SCRIPT.

Also if the script aborts before calling an instance of set_property("CUSTOM_HyboriaStep", <num>); you'll have to manually increment it. This should only happen if your combat against one of the city monsters is aborted for some reason, so just watch out for that.

Code:
void HyboriaQuest()
{
    if (!contains_text(visit_url("questlog.php?which=2"),"Primordial Fear"))
    {
        print("You must complete Primordial Fear before starting Hyboria? I don't even...");
        return;
    }

    if (!contains_text(visit_url("questlog.php?which=2"),"Hyboria? I don't even..."))
    {
        //request_noncombat(0);
        equip($slot[acc1], $item[ring of conflict]);

        if (get_property("CUSTOM_lastHyboriaReset").to_int() < get_property("knownAscensions").to_int())
        {    
            set_property("CUSTOM_HyboriaStep", "0");
            set_property("CUSTOM_lastHyboriaReset", get_property("knownAscensions").to_int());
        }


        while(my_adventures() > 0)
        {
            int step = get_property("CUSTOM_HyboriaStep").to_int();

            if (step > 9)
            {
                if (item_amount($item[memory of a glowing crystal]) == 0)
                {
                    abort("need a memory of a glowing crystal to continue");
                }
            }

            if (step == 14)
            {
                if (item_amount($item[memory of a cultist's robe]) > 0)
                {
                    equip($slot[acc2], $item[memory of a cultist's robe]);
                }
                
            }

            cli_execute("mood execute");
            cli_execute("burn extra mp");

            string url = visit_url("adventure.php?snarfblat=205&pwd");

            if (url.contains_text("You can't take it any more."))
            {
                if (item_amount($item[empty agua de vida bottle]) > 0)
                {
                    visit_url("memories.php");
                }
                else
                {
                    abort("ran out of empty agua de vida bottles");
                }
            }
            else if (url.contains_text("Combat"))
            {
                run_combat();        
            }
            else if (url.contains_text("Cavern Entrance"))
            {
                if (item_amount($item[memory of a glowing crystal]) > 0)
                {
                    visit_url("choice.php?whichchoice=360&option=2&choiceform2=Leave&pwd");
                }
                else
                {
                    // uhhhh wumpus
                    abort("kill the wumpus yourself!");
                }
                
            }
            else if (url.contains_text("Entrance to the Forgotten City"))
            {
                switch (step)
                {
                    case 0:
                        // Step 1
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=3&choiceform3=Go+West&pwd");
                        visit_url("choice.php?whichchoice=371&option=3&choiceform3=Go+South&pwd");
                        visit_url("choice.php?whichchoice=378&option=2&choiceform2=Search&pwd");
                        // Should have 'memory of a grappling hook'
                        set_property("CUSTOM_HyboriaStep", "1");
                        break;
                    case 1:
                        // Step 2
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=3&choiceform3=Go+West&pwd");
                        visit_url("choice.php?whichchoice=371&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=374&option=3&choiceform3=Climb+tower&pwd");
                        // Should fight the 'giant bird-creature'
                        run_combat();
                        set_property("CUSTOM_HyboriaStep", "2");
                        break;
                    case 2:
                        // Step 3
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=3&choiceform3=Go+West&pwd");
                        visit_url("choice.php?whichchoice=371&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=374&option=3&choiceform3=Climb+tower&pwd");
                        // Should have 'memory of half a stone circle'
                        set_property("CUSTOM_HyboriaStep", "3");
                        break;
                    case 3:
                        // Step 4
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=5&choiceform5=Examine+Well&pwd");
                        visit_url("choice.php?whichchoice=372&option=2&choiceform2=Climb+down+into+well&pwd");
                        // Should fight the 'giant octopus'
                        run_combat();
                        set_property("CUSTOM_HyboriaStep", "4");
                        break;
                    case 4:
                        // Step 5
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=5&choiceform5=Examine+Well&pwd");
                        visit_url("choice.php?whichchoice=372&option=2&choiceform2=Take+grappling+hook&pwd");
                        // Should have 'memory of a grappling hook'
                        set_property("CUSTOM_HyboriaStep", "5");
                        break;
                    case 5:
                        // Step 6
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=2&choiceform2=Go+East&pwd");
                        visit_url("choice.php?whichchoice=370&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=375&option=2&choiceform2=Go+upstairs&pwd");
                        // Should have 'memory of an iron key'
                        set_property("CUSTOM_HyboriaStep", "6");
                        break;
                    case 6:
                        // Step 7
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=2&choiceform2=Go+East&pwd");
                        visit_url("choice.php?whichchoice=370&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=375&option=3&choiceform3=Go+downstairs&pwd");
                        visit_url("choice.php?whichchoice=379&option=2&choiceform2=Search+the+webs&pwd");
                        // Should fight 'giant spider'
                        run_combat();
                        set_property("CUSTOM_HyboriaStep", "7");
                        break;
                    case 7:
                        // Step 8
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=2&choiceform2=Go+East&pwd");
                        visit_url("choice.php?whichchoice=370&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=375&option=3&choiceform3=Go+downstairs&pwd");
                        visit_url("choice.php?whichchoice=379&option=2&choiceform2=Search+the+webs&pwd");
                        // Should have 'memory of a small stone block'
                        set_property("CUSTOM_HyboriaStep", "8");
                        break;
                    case 8:
                        // Step 9
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=2&choiceform2=Go+East&pwd");
                        visit_url("choice.php?whichchoice=370&option=3&choiceform3=Go+South&pwd");
                        visit_url("choice.php?whichchoice=377&option=2&choiceform2=Go+Upstairs&pwd");
                        visit_url("choice.php?whichchoice=380&option=2&choiceform2=Search+the+vines&pwd");
                        // Should fight 'giant jungle python'
                        run_combat();
                        set_property("CUSTOM_HyboriaStep", "9");
                        break;
                    case 9:
                        // Step 10
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=2&choiceform2=Go+East&pwd");
                        visit_url("choice.php?whichchoice=370&option=3&choiceform3=Go+South&pwd");
                        visit_url("choice.php?whichchoice=377&option=2&choiceform2=Go+Upstairs&pwd");
                        visit_url("choice.php?whichchoice=380&option=4&choiceform4=Cut+open+the+snake&pwd");
                        // Should have 'memory of a little stone block'
                        set_property("CUSTOM_HyboriaStep", "10");
                        break;
                    case 10:
                        // Step 11 (need 'memory of a glowing crystal' before this I think)
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=369&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=373&option=2&choiceform2=Put+stone+block+into+left+hole&pwd");
                        visit_url("choice.php?whichchoice=373&option=2&choiceform2=Put+stone+block+into+right+hole&pwd");
                        visit_url("choice.php?whichchoice=373&option=2&choiceform2=Pull+lever&pwd");
                        // Doesn't take an adventure
                        // Step 11a Get back to the City Center
                        visit_url("choice.php?whichchoice=373&option=1&choiceform1=Go+South&pwd");
                        visit_url("choice.php?whichchoice=369&option=3&choiceform3=Go+South&pwd");
                        // Step 11b
                        visit_url("choice.php?whichchoice=368&option=2&choiceform2=Go+East&pwd");
                        visit_url("choice.php?whichchoice=370&option=3&choiceform3=Go+South&pwd");
                        visit_url("choice.php?whichchoice=377&option=3&choiceform3=Go+Downstairs&pwd");
                        visit_url("choice.php?whichchoice=381&option=2&choiceform2=Crawl+into+the+tunnel&pwd");
                        visit_url("choice.php?whichchoice=382&option=2&choiceform2=Go+West&pwd");
                        visit_url("choice.php?whichchoice=383&option=3&choiceform3=Go+South&pwd");
                        visit_url("choice.php?whichchoice=384&option=2&choiceform2=Open+the+chest&pwd");
                        visit_url("choice.php?whichchoice=384&option=3&choiceform3=Smash+open+the+chest&pwd");
                        // Should have 'memory of a stone half-circle'
                        set_property("CUSTOM_HyboriaStep", "11");
                        break;
                    case 11:
                        // Step 12
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=2&choiceform2=Go+East&pwd");
                        visit_url("choice.php?whichchoice=370&option=3&choiceform3=Go+South&pwd");
                        visit_url("choice.php?whichchoice=377&option=3&choiceform3=Go+Downstairs&pwd");
                        visit_url("choice.php?whichchoice=381&option=2&choiceform2=Crawl+into+the+tunnel&pwd");
                        visit_url("choice.php?whichchoice=382&option=2&choiceform2=Go+West&pwd");
                        visit_url("choice.php?whichchoice=383&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=385&option=4&choiceform4=Go+North&pwd");
                        visit_url("choice.php?whichchoice=386&option=2&choiceform2=Ponder+the+weights&pwd");
                        // Gate should be kickable now
                        set_property("CUSTOM_HyboriaStep", "12");
                        break;
                    case 12:
                        // Step 13
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=369&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=373&option=2&choiceform2=Kick+gate&pwd");
                        // Gate should be destroyed
                        set_property("CUSTOM_HyboriaStep", "13");
                        break;
                    case 13:
                        // Step 14
                        visit_url("choice.php?whichchoice=366&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=368&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=369&option=1&choiceform1=Go+North&pwd");
                        visit_url("choice.php?whichchoice=373&option=2&choiceform2=Go+North&pwd");
                        visit_url("choice.php?whichchoice=376&option=3&choiceform3=Unlock+the+temple+door&pwd");
                        // Temple should be open
                        set_property("CUSTOM_HyboriaStep", "14");
                        break;
                    default:
                        // Ignore adventure
                        visit_url("choice.php?whichchoice=366&option=2&choiceform2=Leave&pwd");
                        return;
                }
            }
        
            // At this point we need to equip 'memory of a cultist's robe'
        
            else if (url.contains_text("Ancient Temple"))
            {
                url = visit_url("choice.php?whichchoice=367&option=1&choiceform1=Enter+the+Temple&pwd");
                url = run_combat();
                if (url.contains_text("high priest of Ki'rhuss"))
                {
                    // Fuck yeah we're done.
                    visit_url("town_wrong.php?action=krakrox&pwd");
                    return;
                }            
            }        
        }
    }
}

void main()
{
    HyboriaQuest();
}

Sometimes the elegant solution isn't worth the time it takes to code it.
 

Attachments

  • Hyboria.ash
    10.9 KB · Views: 32
Last edited:

Sputnik1

Member
well Halfvoid and GCG,
That's more or less what i want it to do but I wanted to write it to a text file so mafia could close after running, i just dont know how to integrate it with my farming setup.
Im currently running text scripts like this

Code:
closet put * meat
outfit Meat
familiar hobo monkey
closet take 100000 meat
call EatDrinkBCheffy.ash
uneffect ode
csend 7 meat to IocaineBot
concert Elvish
friars food
summon Drinks
cast Vent Rage Gland
call VIPPool.ash 1
call VIPPool.ash 1
call VIPPool.ash 1
closet put 50000 meat
csend 104 meat to Sir Hobo Man
csend 2504 meat to Buffer of the seal clubbers
csend 2501 meat to Buffer of the seal clubbers
wait 30
csend 2504 meat to Buffer of the seal clubbers
csend 2501 meat to Buffer of the seal clubbers
wait 30
csend 2504 meat to Buffer of the seal clubbers
csend 2501 meat to Buffer of the seal clubbers
wait 30
csend 2504 meat to Buffer of the seal clubbers
csend 2501 meat to Buffer of the seal clubbers
wait 30
csend 2504 meat to Buffer of the seal clubbers
csend 2501 meat to Buffer of the seal clubbers
wait 30
csend 2504 meat to Buffer of the seal clubbers
csend 2501 meat to Buffer of the seal clubbers
wait 30
nuns
closet put * meat
ccs cheffy
puttyfarm.ash
adventure 15 farm
ccs cheffy
adventure * castle
uneffect carlweather
status refresh
call CastleAutosellScript.txt
csend 1 meat to kolabuff
csend 1 meat to Testudinata
csend 3 meat to Testudinata
csend 4 meat to Testudinata
csend 5 meat to Testudinata
csend 6 meat to Testudinata
csend 8 meat to Testudinata
csend 9 meat to Testudinata
csend 12 meat to Testudinata
csend 270 meat to Testudinata
csend 140 meat to Testudinata
wait 60
status refresh
call EatDrinkRCheffy.ash
cast * love
Nuns
cast * love
Nuns
cast * love
outfit rollover
closet put * meat

So I want it to do all of this but include the meat reading steps, if someone can help me get this into an ash setup, that might help a lot
 

zarqon

Well-known member
Wow Rinn, thanks for sharing. Your "inelegant" solution nonetheless makes writing an elegant one much easier.
 
So I want it to do all of this but include the meat reading steps, if someone can help me get this into an ash setup, that might help a lot

Well this may not be the prettiest solution... But you can execute cli commands from ash using cli_execute()

So if you don't want to take the time to convert all of those to ash functions, you can wrap each line in a cli_execute(), like this:

Code:
cli_execute("closet put * meat");
cli_execute("outfit Meat");
cli_execute("familiar hobo monkey");
cli_execute("closet take 100000 meat");
cli_execute("call EatDrinkBCheffy.ash");
...

The ash function logprint() prints to your session log. So you can use that print out the info you want to the log. Something like this for example:

Code:
logprint("Meat gained: " + my_meat());

Now like I said, this is certainly not the prettiest solution. However it is quick and easy, and seems to fit your needs. If you want to actually convert all of the cli commands into ash ones, I would take a look at the wiki: http://wiki.kolmafia.us/index.php?title=Main_Page
 

zarqon

Well-known member
You don't even need the quotes/semicolons if you use brackets. Also, you can do something similar with chunks of ASH in CLI scripts, which may be the better alternative in a mostly CLI script. Check it out.
 

Sputnik1

Member
thanks guys, will try what ive got going after rollover and ill try to work out any bugs i see

one quick question...
Does the command my_meat() check to see how much meat is contained within the closet?
If it only checks the amount on hand then i need to to change how I handle my meat through my script.
 
Last edited:

dj_d

Member
I have a new item for the script wishlist.

buff(effect, duration);

* If you have the appropriate buff, cast it for duration turns
* Consider all non-philanthropic buffbot offerings for effect
* Send meat to acquire effect for a minimum of duration turns as quickly as possible
* If duration is zero, buy one shot of whoever offers the effect on the cheapest meat-per-adventure basis
* Check periodically until the buff takes effect

Some stuff you probably need to do to implement this right:
* Parse buffbot XML files (stored internally in buffbot.txt, I think)
* If you don't receive the buff after some period of time, take note of that fact, and make it less likely to use that buffbot in the future
* Allow you to add clan-specific buffbots in preferences
 
I have a new item for the script wishlist.

buff(effect, duration);

* If you have the appropriate buff, cast it for duration turns
* Consider all non-philanthropic buffbot offerings for effect
* Send meat to acquire effect for a minimum of duration turns as quickly as possible
* If duration is zero, buy one shot of whoever offers the effect on the cheapest meat-per-adventure basis
* Check periodically until the buff takes effect

Some stuff you probably need to do to implement this right:
* Parse buffbot XML files (stored internally in buffbot.txt, I think)
* If you don't receive the buff after some period of time, take note of that fact, and make it less likely to use that buffbot in the future
* Allow you to add clan-specific buffbots in preferences

I like that idea, I did something similar to it for my farming script (though I hard-coded the prices because it was a lot simpler that way.) The main thing I would have to do is adapt it to read the xml files, which of course is the tough part... Does anyone have any idea how to parse an xml file with ash?
 

Alhifar

Member
Honestly, I wouldn't bother writing a generic XML parser for ash, simply look for the specific strings you need.
 
Here's what I've got so far, in case I'm busy for a little while at least this code will be out there. This gets the price list from the xml file into a usable format:

Code:
record buff_data {
	string name;
	int skill_id;
	int price;
	int turns;
	boolean philanthropic;
};

buff_data get_buff_data(string xml) {
	matcher match_name = create_matcher(".*<name>(.*)</name>.*", xml);
	matcher match_skill_id = create_matcher(".*<skillid>(.*)</skillid>.*", xml);
	matcher match_price = create_matcher(".*<price>(.*)</price>.*", xml);
	matcher match_turns = create_matcher(".*<turns>(.*)</turns>.*", xml);
	matcher match_philanthropic = create_matcher(".*<philanthropic>(.*)</philanthropic>.*", xml);
	match_name.find();
	match_skill_id.find();
	match_price.find();
	match_turns.find();
	match_philanthropic.find();
	buff_data bd = new buff_data;
	bd.name = match_name.group(1);
	bd.skill_id = to_int(match_skill_id.group(1));
	bd.price = to_int(match_price.group(1));
	bd.turns = to_int(match_turns.group(1));
	bd.philanthropic = to_boolean(match_philanthropic.group(1));
	return bd;
}

buff_data[int] parse_buff_file(string url) {
	buff_data[int] buffs;
	string xml = replace_string(visit_url(url), "\n", "");
	string[int] buff_listings = split_string(xml, "</buffdata>.*?<buffdata>");
	foreach key, val in buff_listings {
		buffs[count(buffs)] = get_buff_data(val);
	}
        return buffs;
}

void main() {
	parse_buff_file("http://www.iocainepowder.org/iocainebot/iocainebot.xml");
}

When I get some more time I'll work on adding in some error checking and then using that data to get the buffs.
 

mottsy

Member
I can't really think of anything to make at the moment, so if anyone has any requests let me know and I'll try to work on them :)

a script that automaticly chooses a bounty hunt with the lowest count of items, spooky putties the monster, and fights them through putty, using a 4d camera to capture it again so it can be spookied again

lets see you try that :)

(someone think of something more complicated ASAP)
 

mredge73

Member
a script that automaticly chooses a bounty hunt with the lowest count of items, spooky putties the monster, and fights them through putty, using a 4d camera to capture it again so it can be spookied again

doesn't bounty.ash combined with FTF in your CCS already do that?
 

zarqon

Well-known member
You would also need the Best Between Battle script for auto-fighting the puttied monsters, but yes, that combo will do it. However, currently there is no camera support in FTF.
 
Top