Feature - Implemented expose zone id

taltamir

Member
is it possible to expose the zone id somehow? it is tracked internally by mafia. but using .to_int() does not work
Code:
> ash $location[noob cave].to_int()

Function 'to_int( location )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. ()
Returned: void
however you can see it via
Code:
> ash to_url($location[noob cave]);

Returned: adventure.php?snarfblat=240
in this case the zone id is 240

this is needed for hosing down an area in wildfire. the url to hose down an area is:
Code:
visit_url("place.php?whichplace=wildfire_camp&action=wildfire_captain");
visit_url("choice.php?option=1&whichchoice=1451&pwd=&zid=" +TARGET);
where TARGET is the zone id of the target zone. (hence the zid= portion of the url)
so for noob cave it would be zid=240
 

taltamir

Member
So, I received advice from mafia scripting on discord on how to extract the relevant data from to_url() by using
Code:
place.to_url().split_string("=")[1]
it would still be nice if there was a zid as part of a location's record so we could do
place.zid
to get it instead of the overly hacky method above
 
Last edited:
I can do you one hackier: my_location().to_url().to_int()
Mafia will complain every time that the entire string is not an integer, but successfully return the zone number anyway :p
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Addressed in r25702 (.id and to_int() both work on $location)
 
Top