How do you run a script automatically only once/day?

QVamp

Member
I'd like to do a number of things only once/day, that I've written into an ash script. I could turn each command into a daily deed, but that would be rather unwieldy, and I'd just like it to automatically run, rather than having to click on a series of boxes.

Based on the automation slots, I don't see anything that aligns with 1x/day. I guess 'on login' is the closest, but it would run each time I log in, which isn't guaranteed to be only 1x/day.

Is the best place to hook up this ash script in the 'on login' spot? And is there a way to wrap the content in some sort of test that ensures it only runs once? There must be some variable, or similar, that states when to do breakfast... so can I hook it up to that somehow?
 

heeheehee

Developer
Staff member
I usually use the loginScript slot and conditionally trigger on preferences, e.g.
Code:
  if (get_property("stenchAirportAlways") == "true" && can_interact() && retrieve_item(1, $item[bag of park garbage])) {
    visit_url("place.php?whichplace=airport_stench&action=airport3_tunnels");
    run_choice(6);
    run_choice(7);
  }

If Mafia doesn't track a thing you want to, you could just set your own variable, "_QVampBreakfastScriptRan" or something --- preferences prefixed with an underscore are reset on the first login of the day.
 

Bale

Minion
That sounds like it would work. What are the variables reset to? Not existing? 0? false?

Any user defined variable that starts with an _underline _character is reset to not existing after rollover.

If it is a variable defined in defaults.txt then it is reset to whatever defaults.txt says.
 

Veracity

Developer
Staff member
"" or 0 or false - depending on whether you look at it as a string, int, or boolean. They are all the equivalent of unset...
 

Bale

Minion
My answer might be technically correct, but I like Veracity's answer better since that is how we all use the information.
 
Top