Script variable that resets at rollover.

fronobulax

Developer
Staff member
I want a persistent variable that resets to a particular value the first time the script is called after rollover. Is there already a mechanism for this or do I have to monitor a mafia maintained daily value? If the latter, is there one that is suggested?

Basically I want a value that tells me how much meat eatDrink has already spent "today". I can increment that as necessary but I would want it set to zero after rollover.

I expect to use zLib.

Thanks.
 

lostcalpolydude

Developer
Staff member
I believe any variable name that begins with _ is automatically reset at rollover, so you could use _eatDrinkSpending.
 

heeheehee

Developer
Staff member
Preference, actually, which, as you probably know, can be set/accessed via set_property() and get_property().
 

heeheehee

Developer
Staff member
I think they actually reset to the empty string (''), so the script in question (EatDrink?) could probably just check if(get_property('_eatDrinkWhatever')=='') and set it to whatever value then.

Edit: Also, either way, fronobulax seems like he wants it to reset to 0 on rollover, so it's mostly a moot point, I guess.
 

fronobulax

Developer
Staff member
Reset to zero is ok.

I was under the influence when I asked the question and left out one key point. I consider items in USERNAME_prefs.txt to be mafia values and items in vars_USERNAME.txt to be script values. All other things being equal I'd like to store in the latter for reasons I can't really articulate. It sounds like it is trivial if I use a mafia daily property so that may be how I end up anyway. Thanks.
 

slyz

Developer
If you use a zlib setting, you would need to create another setting where the KoL date is stored, to see when eatDrinkSpending was last reset.
 
Top