current page html

I'd like to overload the run_choice() command to accept a string, then use regex to find the corresponding choice button with that text, and then pass the choice # of that button to the regular run_choice() command. run_choice() doesn't take a buffer parameter, but it somehow has access to the page of the most recent visit_url() returned. Is this buffer exposed somewhere so that I can use it instead of needing to pass it in to my overloaded function myself?
 
I actually found a different answer that suits me well enough. available_choice_options() returns a map of type string[int] of all buttons' text and choice #s, already parsed by KoLmafia.
 

Veracity

Developer
Staff member
I was about to suggest that.

If you are calling run_choice, presumably you previously made a call - like visit_url() - that gave you the page text.
As you discovered, you can just use available_choice_options(), which already parsed the buttons.

There are cases - like the Barf Mountain kiosk, which offers you two tasks, both with descriptive text and a button labeled "Accept Assignment" - where you need the page text, not the button text. But others - monorail, eldritch tentacle, etc. - have a useful button text but the option # may change, and available_choice_options is all you need.
 
Top