A question regarding choice adventure handling

GValko

Member
I'm trying to script out the Jungle quest, and I'm hitting an annoying roadblock.

Since some of the choice adventures are dynamic, it's making it difficult to get the right result.

For example, if I wanted to get the semicircle from the Catacombs dead end, I would have to first examine the box, and then smash it open.

Before examining, the option to actually smash the chest doesn't appear. It would be mapped to the "leave City" option. Nor does it cause the examine option to disappear, meaning if I left "ChoiceAdventure384=2" I would loop.

I'm wondering if there's anyway to be able to interrupt the handling of a choice adventure, so I can switch the value before it gets looped. I have one method in mind (brute forcing the choices), but I'm wondering if there's a somewhat more elegant answer.
 
Last edited:

Spiny

Member
Can contains_text help with this? If page contains_text(open the chest), do choice=whatever, else if page contains_text(smash the chest), do choice=whatever it should be now?

I don't know if that is possible in this situation, but it was a thought.

-Spiny
 

Bale

Minion
I think Spiny's correct, but that leaves the question of HOW to do this. Fortunately Alhifar has already done most of the work. You should be able to use this wonderful run_adv function as the basis of your answer:


Code:
string run_adv(string page_text) {
	matcher m_choice = create_matcher("whichchoice value=(\\d+)", page_text);
	while( contains_text(page_text, "choice.php") ) {
		m_choice.reset(page_text);
		m_choice.find();
		
		string choice_adv_num = m_choice.group(1);
		string choice_num = get_property( "choiceAdventure" + choice_adv_num );
		
		if( choice_num == "0" ) return "Manual Control";
		if( choice_num == "" ) abort("Unsupported Choice Adventure!");
		
		string url = "choice.php?pwd&whichchoice=" + choice_adv_num + "&option=" + choice_num;
		page_text = visit_url(url);
	}
	if( contains_text(page_text, "Combat") ) run_combat();
	return page_text;
}

adv_result = run_adv(to_url($location[distant past]).visit_url());

Obviously it needs to be modified somewhat for your purpose. :)
 

GValko

Member
Thanks Bale. I suppose I'll get cracking on this, sooner or later.

It's automating that stupid chest and starting the machinery that's proving to be difficult.
 

Bale

Minion
Well, now that you can run a contains_text on page_text if you see those specific choice_adv_num to set choice_num, it should be a breeze! Alhifar's a genius.

Just don't remove anything you find redundant: remember that a choice adventure can lead to another choice adventure or a combat and you don't want to break that. I found that a tiny bit tricky once.
 
Last edited:
the Jungle is sapping my will to live!
Bale - you mentioned that Alhifar had done a script, dunno if i'm being blind or if i just can't find it, all i cna ever find it a script for the future. I've already gotten teh pig iron stuff but still want each class reward, so i have another 3 boring explorations ahead of me,and that's just for my main, the prospect is bringing me close to tears.

Any help?
 
Top