Unsuccessful commands stop script

Hello. I have another question.

I'm running Windows XP SP2, Java 1.6.0_11, and KoLmafia v13.3.1.

I've noticed that certain commands will stop my scripts if KoLmafia is unable to complete them. For instance if I try to put on an outfit that the character doesn't have.

Well, my question is how do I get the script to continue even if those things fail.

Here's the script:

Code:
void suit_up(){
	// Put on adventureing gear.
	(outfit ("MaxMuscle") );
	print ("Ready to go!", "green");
}
void farm_all(){
	cli_execute("adventure * Fantasy Airship");
}
void main (){
	suit_up();
	farm_all();
}

I would like this script to adventure even if I don't have that outfit.
 

Bale

Minion
What you have to do is to trap the returned error condition.

if( outfit ("MaxMuscle") ) {}

This passes the return value to the if() statement which simply does nothing with it. You could also pass the value to a variable, but that would require defining a variable that does nothing, so I prefer this solution.
 

Bale

Minion
NP! Passing on clever techniques to someone who knows how to make use of them is actually enjoyable.

We were all newbies once upon a time. I did not invent that technique myself. I actually learned that interesting trick from zarqon and just marveled at its brilliant simplicity. Now I get to pass it on to another.
 
Top