Can I script an event that only occurs on a specific day of the month
Quilistan
Member Posts: 186
I would like a password stored on a (door, object, or invisible creature) to change on the 11 day of each game time month. It is possible to script this without using the onheartbeat timer? If so how?
0
Comments
Though there is a calendar of sorts built into the game, it's been implemented as measurement tool rather then an event driver.
For the sake answering your question: Yes you can, but it's not really any better than onHeartBeat.
You can do it recursively by calling DelayCommand(ExecuteScript()). It's not really any better then onHeartBeat because the amount of seconds you would need to delay it by is huge, and the module level onHeartBeat will be called several times during that time either way.
The other way to do it, is like this:
Store a timestamp of when the password will expire. (The next 11th from the current date.)
Now you have two options.
1. Check if the password has expired in the main HeartBeat script. If so, change it, and update the stored timestamp.
2. When someone tries to use/enter/accuire the password, check if it's expired and change it. This would still work if no one had tried enter the password for three months, so it didn't get changed in all that time. No one needs to know that, and because it checks for expiration first, no one's going to be able to get in with a months old password.
Let me know if you need help with timestamps or any of the coding on it.
I have seen a time stamp script before, but I am not sure on how to check if it has advanced or not? Since the time is a month/day/year type thing. I am use to running timers and heartbeat checks.
I am going to be away for a few days.... vacation.
will certainly be checking back here when I get home.
Here is what I have for timestamps.
After changing the password, you would call GetFutureTimestamp() and save that locally or to a database. (I think locally makes more since, unless you have some script that saves the game date over resets.)
Then to check if it's expired it's as easy as if([savedTimestamp] < GetCurrentTimestamp()).