A question regrding KOL choices in scripting

DarylHark

New member
Hello all. I'm somewhat new to scripting and not particularly good. What I've learned I did from reading various .ash scripts and trying to reverse engineer them. My question, specifically, is how do I get a script to make a choice for me when provided with one in KOL.

I'll use "a Jukebox" in the clan rumpus room as an example. If I would like my script to visit the Jukebox and select a song for me, what is the basic command to make that choice? I know how to send it to the Jukebox via the visit_url function. For example, "visit_url("clan_rumpus.php?action=click&spot=9&furni=3");" seems to work wonderfully to visit A Potted Meat Tree for me. However, any URL that forces me to make a choice is something I don't know how to deal with.

To choose one of the 4 options (songs) provided by the Jukebox, do i use a refined example of visit_url, perhaps with a more specific path? If so, how do I find this path?

I suppose many similar situations are covered by KOLMafia's Choice Adventures settings, but I didn't see the Jukebox as an option, and even if I did I still would like to know how to select a choice if KOLMafia hasn't preset the encounter as a choice adventure.

Another example of a situation where'd I'd like to be able to use such a function is the Frat House after the war, where you can choose various buffs.

Thank you in advance for any help and forgive me if I'm asking something obvious, but I have been looking for days to figure this out.
 

heeheehee

Developer
Staff member
The simplest way to find the URL, even if it involves POST-data (like in the event of choices), is often to just visit the page in the Mini-Browser and select the choice in question. It'll be in the address bar (so to speak).

An alternative is understanding HTML and scraping the page in question, but that's generally seen as more complicated.

But for visiting the island arena, have you tried cli_execute("concert elvish") or something in that vein? Oftentimes these things are available as CLI commands, but not as ASH functions. You can get around this by just using cli_execute().
 
Top