betweenBattleScript before combat item

eegee

Member
Since betweenBattleScript is executed before using an item that could lead to combat, I wanted to know how would I go about detecting when I'm about to fight a rotten dolphin thief.

I have tried checking my_location() and get_property("lastAdventure") (both seem to be synonymous), and the location is always my previous location instead of the new one when a combat-spawning-item is used. I had thought that since my_location() points to the location about to visited, it would be $location[none] and get_property("lastAdventure") would be my previous location.
 

Veracity

Developer
Staff member
Revision 10411 will make sure that my_location() returns $location[ none ] when you run a betweenBattleScript before using an item that might lead to an adventure due to spawning a monster, either in the Relay Browser or via script or Item Manager.

As you noticed, my_location() simply returns the value of the lastAdventure property. In a consult script or any script run manually between adventures, that is correct. In a betweenBattleScript, it is the value of the NEXT adventure - perhaps; a black pudding might not spawn a monster, for example - but we don't have a distinct nextAdventure variable to reflect that.

If you can come up with a compelling reason why a betweenBattleScript might want to know where you really did adventure last, as opposed to where you are about to go, I'll consider making that distinction, but, in my opinion, my_location() returns exactly what you need to know, regardless of the name of the property it fetches.
 

Bale

Minion
There is a significant difference between my_location() and get_property("lastAdventure"). If the last adventure is a non-combat then get_property("lastAdventure") will return the name of that non-combat instead of the location name.
 

Veracity

Developer
Staff member
There is a significant difference between my_location() and get_property("lastAdventure").
Code:
	public static Value my_location()
	{
		String location = Preferences.getString( "lastAdventure" );
		return location.equals( "" ) ? DataTypes.parseLocationValue( "Rest", true ) : DataTypes.parseLocationValue( location, true );
	}
 

eegee

Member
...a black pudding might not spawn a monster, for example - but we don't have a distinct nextAdventure variable to reflect that.

If you can come up with a compelling reason why a betweenBattleScript might want to know where you really did adventure last, as opposed to where you are about to go, I'll consider making that distinction, but, in my opinion, my_location() returns exactly what you need to know, regardless of the name of the property it fetches.
I agree, my_location() works perfectly when calling a betweenBattleScript. The reason I wanted to try get the location of the previous adventure was because I was using the Harvest script, and that script uses dolphin whistles while I'm adventuring in the Sea. I know I could modify the script, but that isn't the best way because I might use a dolphin whistle from my inventory instead. What I would really like, unless I missed that function, would be for a way to check which combat I might be entering.

EDIT: I just re-checked the wiki of the rotten dolphin thief. I don't actually need a better equipment because the dolphin will always drop its item if it is defeated. The feature might still be useful for other cases though.
 
Last edited:
Top