set_property question (ASH)

muffins

Member
Just wanted to make sure I had this correct before adding it to my breakfast routine... I saw a suggestion made for using this for fullness in another thread, and wanted to see if I had the right idea...

Okay, point being, I'd like to summon 5 candy hearts a day automatically, and no more unless I choose to do so manually. Here's what I have:

Code:
if(set_property("candyhearts_" + today_to_string(), "0")) { use_skill(5, $skill[Summon Candy Hearts]); set_property("candyhearts_" + today_to_string(), "1"); }

I wasn't sure if there was any way to actually just check if a property exists in the first place, or is null. I thought about setting today's property to zero before calling that line, but realized it would essentially null and void that if check if I logged in again... I thought about doing something a bit... "simpler", such as just storing the date as a property, and, if the date did NOT match the current date (i.e., it was set last yesterday), it would summon them, and if not, if wouldn't...

So, as usual, any suggestions? :)

Edited to fix the title... darn new keyboard typo demons!
 

Nightmist

Member
Uh wouldn't this script add a extra line to your pref's file like every new day? resulting is massive mafia slowdown eventually once the number of candyhearts_xxxxxxxx properties start adding up? Why not just set "OldRunDate" to today_to_string() and then do a if( today_to_string() != get_property( "OldRunDate"))? (Ignoring that "today_to_string" might not exactly mean new rollover, but this method is just as effective as your example given which also uses today_to_string)

PS. In your code you might want to be using a get_property check in your if not a set_property since its just going to set it to 0 and return true all the time... (Unless my understanding of set_property is wrong)
 
Top