Selecting a choice in an adv with ASH - a noobie question

JohnnyRamrod

New member
Folks, i mess with existing .ash scripts sometimes, but i'm not going to pretend i'm much of a scripter. a mess with an MMG script here, and minor tweak of autoascend there. i'm curious about what are the scripting commands the get choice advs to actually CHOOSE an option. take an example like Spooky Forest>Arboreal Respite. Two questions:

1. can i execute a script in the middle of a choice adv? so if wrote a basic script to do choices will it work if i call it from scripts drop-down menu?

2. what is the actual ash command to make the choice. i've been digging around scripts a bit, but taking an example like bumcheekascend for anything other than purely obvious things makes my brain explode, and looking at the wiki hasn't really helped. i kinda want to get half decent, but apart from the obvious things i'm just not getting far. and understanding a level of auto-adventuring syntax i reckon would help... or not...

any pointers, or even just some pretty damn basic scripts that i don't have to wade through too much to get the mechanics a little better? or am i just a lost cause????
 

Bale

Minion
1. Yes. You can manually start a script in the middle of a choice by calling it from the drop-down menu. You can also automate a choice that was started by a script.

2. There are no ash commands specifically to make choices in a choice adventure. You'll need to use visit_url() or cli_execute("choice x") to select the option. If you need to parse the page to decide what you are doing next, then you'll need to use visit_url() and plug in the html link for selecting a choice. For some reason I always tend to prefer it to the cli command, even when I don't need to parse the page returned by KoL.


any pointers, or even just some pretty damn basic scripts that i don't have to wade through too much to get the mechanics a little better? or am i just a lost cause????

Here's a simple example I found lying around. This is a function that I used to dive for treasure in the Clan swimming pool, before KoLmafia added automation for it. This is nice because it is very basic example of how to use visit_url() to select choices.

Code:
void DiveForTreasure() {
	visit_url("clan_viplounge.php?preaction=goswimming&subaction=screwaround");
	visit_url("choice.php?whichchoice=585&pwd&option=1&action=flip");
	visit_url("choice.php?whichchoice=585&pwd&option=1&action=treasure");
	visit_url("choice.php?whichchoice=585&pwd&option=1&action=leave");	
}
 
Hey Johnny, if you are trying to learn more I'd recommend taking a look at my script, specifically the desert code of unlocking the pyrimid. It was my first automation code written and as such everything there is pretty simple and it goes over the top when doing URLs.

First tho, you need something like Notepad++ and and an ASH defined language, if you don't already have those set up. Colors make a huge difference when looking at code.

One thing you can do, if you don't plan on changing choices, is to set all your choices beforehand (set_property("choiceAdventureXXX", "X");) and when you get to a choice just run cli_execute("choice goal"); (or just "choice goal" if typing into CLI).

If you are changing your choice selection based on info like unlocking the hidden temple, then you'd have to change choices based on the info beforehand. For instance, my code for unlocking the temple...(I removed the extra stuff)

Code:
print("Unlocking the hidden temple.", "blue");
	
	if (i_a("tree-holed coin") < 1) {
		print("First getting the tree-holed coin", "blue");
		set_property("choiceAdventure502", 2);
		set_property("choiceAdventure505", 2);
		EoD_Adv("tree-holed coin", 1, $location[The Spooky Forest]);
	}

	if (i_a("Spooky-Gro fertilizer") < 1) {
		print("Next getting the spooky-gro fertilizer.", "blue");
		set_property("choiceAdventure502", 2);
		set_property("choiceAdventure506", 2);
		EoD_Adv("spooky-gro fertilizer", 1, $location[The Spooky Forest]);
	}
		
	if (i_a("spooky sapling") < 1) {
		print("Next getting the spooky sapling.", "blue");
		set_property("choiceAdventure502", 1);
		set_property("choiceAdventure503", 3);
		set_property("choiceAdventure504", 3);
		EoD_Adv("spooky sapling", 1, $location[The Spooky Forest]);
		set_property("choiceAdventure504", 4);
	}

	if (i_a("Spooky Temple map") < 1) {
	        print("Next getting the spooky temple map.", "blue");
		set_property("choiceAdventure502", 2);
		set_property("choiceAdventure506", 3);
		set_property("choiceAdventure507", 1);
		EoD_Adv("spooky temple map", 1, $location[The Spooky Forest]);
	}
	cli_execute("use spooky temple map");
	print("Temple has been unlocked!", "green");

The EoD_Adv function just does this

Code:
 while (to_item("string of item") < number (in this case all 1))
        adventure(1, $location[place to get item]);

Reading this in Notepad++ is way easier ;)
 
Last edited by a moderator:

JohnnyRamrod

New member
Thanks to you both. I'll start digging around and have a play, and maybe post back depending on what I work through. appreciate it a lot!
 
Top