The "on time" event listens to UO time and not our time. You can use the getYear, getMonth, getWeek, getDay, getHour, getMinute, getSeconds script functions to retreive the UO time. OSI's Time Manager object is reponsible for increasing the time and starting new seasons etc. The code that does this is located at EIP 0x004D8A9A.
One UO second equals one tick. This means that 4 UO seconds are equal to one human second.
This is a complete table:
1 UO second = 1 tick = 0.25 human seconds (if no lag)
1 UO minute = 20 UO seconds = 5 human seconds
1 UO hour = 60 UO minutes
1 UO day = 24 UO hours
1 UO week = 7 UO days
1 UO month = 4 UO weeks = 28 UO days
1 UO year = 12 UO months = 336 UO days
The file TIME.MUL.Q is a file containing a single dword and represents the UO hour. The Time Manager loads this on startup. The core does not read the year, month etc. Why this is I do not know, it does not seem logical to start from year 0 every server reboot...
The "on time" event supports the following time identfiers: year, month, week, day, hour, minute. This event does not supports seconds, use the callback mechanism instead.
I've created a sample script that logs the current UO time:
- Code: Select all
on creation()
{
string s = "";
getCurrentTimeStr(s);
s = s + " / "+ getTimeSecs(void);
s = s + " / " + getYear() + "-" + getMonth() + "-" + getDay()
+ " (" + getWeek() + ") "
+ getHour() + ":" + getMinute() + ":" + getSeconds();
systemMessage(this, "Creation: " + s);
shortcallback(this, 0x00, 0x90);
return(0x01);
}
on time<"min:*0">()
{
string s = "";
getCurrentTimeStr(s);
s = s + " / "+ getTimeSecs(void);
s = s + " / " + getYear() + "-" + getMonth() + "-" + getDay()
+ " (" + getWeek() + ") "
+ getHour() + ":" + getMinute() + ":" + getSeconds();
systemMessage(this, "Min: " + s);
return(0x01);
}
on callback<0x90>()
{
string s = "";
getCurrentTimeStr(s);
s = s + " / "+ getTimeSecs(void);
s = s + " / " + getYear() + "-" + getMonth() + "-" + getDay()
+ " (" + getWeek() + ") "
+ getHour() + ":" + getMinute() + ":" + getSeconds();
systemMessage(this, "Callback: " + s);
shortcallback(this, 0x00, 0x90);
return(0x01);
}
This resulted in the following output:
NOTE
This means that:
1) on time<"min:*0">() = event thrown every 10 UO minutes or ±50 human seconds
2) on time<"min:**">() = event thrown every UO minute or every 20 ticks or every ±5 human seconds
IMPORTANT
UO time is tick-driven! This means that 1 UO second is atleast 0.25 seconds, but if there is server-side lag, 1 tick can take longer than 0.25 seconds. The duration of a tick is highly influenced by server-load!
To retreive the current server-side tick, you can use the getPulseNum function.