Unknown2004-12-16 21:13:04
Has anyone figured out an algorithm to have zMud convert a IRL date into a Lusternian one?
I know you can do it via Lusternia's DATE command, I'd like to be able to do it internally though so I can use it in scripts.
Off the top of my head, I can't think of any way to do it. Would be simple if zMud featured unix timestamps but since it doesn't, dang. (Or does it?)
I know you can do it via Lusternia's DATE command, I'd like to be able to do it internally though so I can use it in scripts.
Off the top of my head, I can't think of any way to do it. Would be simple if zMud featured unix timestamps but since it doesn't, dang. (Or does it?)
Unknown2004-12-16 21:38:28
Only problem is IC time seems to hit bumps sometimes
Unknown2004-12-16 21:55:32
dang, I all forgot about that too. *cringe*
Edit: Still looking for a way to do it though
Edit: Still looking for a way to do it though
Unknown2004-12-16 23:06:35
mwahahah! I did it!
#VAR timestamp {%literal(%exec("#script {%literal(function gettimestamp(y,m,d,h,n,s):gettimestamp=DateDiff("s","1/1/1970 00:00", DateSerial(y,m,d)+TimeSerial(h,n,s)):end function)}")%if((%isnumber(%1) and %isnumber(%2) and %isnumber(%3) and %isnumber(%4) and %isnumber(%5) and %isnumber(%6)),%mss("gettimestamp(%1,%2,%3,%4,%5,%6)"),%null))}
oooooh
timestamps in zmud!
#echo @timestamp(2004,12,16,23,52,0)
...solved via some VBScript
Oh and, I know the code is ugly
CODE
#VAR timestamp {%literal(%exec("#script {%literal(function gettimestamp(y,m,d,h,n,s):gettimestamp=DateDiff("s","1/1/1970 00:00", DateSerial(y,m,d)+TimeSerial(h,n,s)):end function)}")%if((%isnumber(%1) and %isnumber(%2) and %isnumber(%3) and %isnumber(%4) and %isnumber(%5) and %isnumber(%6)),%mss("gettimestamp(%1,%2,%3,%4,%5,%6)"),%null))}
oooooh
timestamps in zmud!
#echo @timestamp(2004,12,16,23,52,0)
...solved via some VBScript
Oh and, I know the code is ugly
Unknown2004-12-17 01:51:38
Allright, here it is!
#VAR timestamp {%literal(%exec("#script {%literal(function gettimestamp(y,m,d,h,n):gettimestamp=DateDiff("s","5/19/2001 21:17", DateSerial(y,m,d)+TimeSerial(h,n,0)):end function)}")%if((%isnumber(%1) and %isnumber(%2) and %isnumber(%3) and %isnumber(%4) and %isnumber(%5)),%mss("gettimestamp(%3,%1,%2,%4,%5)"),%null))}
#VAR lusterniandate {%literal(%eval(%mod(%eval(@timestamp(%1,%2,%3,%4,%5)/3600),25)+1)%item({th|st|nd|rd|th|th|th|th|th|th},%eval(%rightback(%eval(%mod(%eval(@timestamp(%1,%2,%3,%4,%5)/3600),25)+1),1)+1)) of %item({Estar|Urlachmar|Kiani|Dioni|Vestian|Avechary|Dvarsh|Tzarin|Klangiary|Juliary|Shanthin|Roarkin},%eval(1+%mod(%eval(@timestamp(%1,%2,%3,%4,%5)/90000),12))) %eval(@timestamp(%1,%2,%3,%4,%5)/90000/12+1))}
For some reason, one of the brackets of my codeblock gets replaced by the forum, you need to replace the part that say & #40; with a (!
Copy&Paste those two commands into the command line to install the code.
Now, you can do like #ECHO @lusterniandate(month,day,year,hour,minute) to get that IRL date converted into the corresponding Lusternian one.
I actually think my algorythm is more precise as the one used in the in-game DATE command, since my script takes into account that midnights in Lusternia happen at 17 minutes past the full IRL hour, whereas DATE only works with full hours. Try DATE 1 KIANI 1 and you'll see it change back and forth between 21:00 and 22:00, depending on whether you're ahead of or behind those 17 minutes.
the @timestamp algorythm used in this little script is not the same as the one I posted earlier, it won't give you a true unix timestamp but a Lusternian one, since it refers to the "Lusternia Epoch" or rather the 1st of Kiani of year 1, rather than the unix one. Also, this version doesn't let you specify seconds for your IRL date, since seconds don't really matter for Lusternia's dates. If you want a timestamp that's precise down to the second and gives you the same date as a standard unix function would, use the code from my earlier post.
-David
CODE
#VAR timestamp {%literal(%exec("#script {%literal(function gettimestamp(y,m,d,h,n):gettimestamp=DateDiff("s","5/19/2001 21:17", DateSerial(y,m,d)+TimeSerial(h,n,0)):end function)}")%if((%isnumber(%1) and %isnumber(%2) and %isnumber(%3) and %isnumber(%4) and %isnumber(%5)),%mss("gettimestamp(%3,%1,%2,%4,%5)"),%null))}
CODE
#VAR lusterniandate {%literal(%eval(%mod(%eval(@timestamp(%1,%2,%3,%4,%5)/3600),25)+1)%item({th|st|nd|rd|th|th|th|th|th|th},%eval(%rightback(%eval(%mod(%eval(@timestamp(%1,%2,%3,%4,%5)/3600),25)+1),1)+1)) of %item({Estar|Urlachmar|Kiani|Dioni|Vestian|Avechary|Dvarsh|Tzarin|Klangiary|Juliary|Shanthin|Roarkin},%eval(1+%mod(%eval(@timestamp(%1,%2,%3,%4,%5)/90000),12))) %eval(@timestamp(%1,%2,%3,%4,%5)/90000/12+1))}
For some reason, one of the brackets of my codeblock gets replaced by the forum, you need to replace the part that say & #40; with a (!
Copy&Paste those two commands into the command line to install the code.
Now, you can do like #ECHO @lusterniandate(month,day,year,hour,minute) to get that IRL date converted into the corresponding Lusternian one.
I actually think my algorythm is more precise as the one used in the in-game DATE command, since my script takes into account that midnights in Lusternia happen at 17 minutes past the full IRL hour, whereas DATE only works with full hours. Try DATE 1 KIANI 1 and you'll see it change back and forth between 21:00 and 22:00, depending on whether you're ahead of or behind those 17 minutes.
the @timestamp algorythm used in this little script is not the same as the one I posted earlier, it won't give you a true unix timestamp but a Lusternian one, since it refers to the "Lusternia Epoch" or rather the 1st of Kiani of year 1, rather than the unix one. Also, this version doesn't let you specify seconds for your IRL date, since seconds don't really matter for Lusternia's dates. If you want a timestamp that's precise down to the second and gives you the same date as a standard unix function would, use the code from my earlier post.
-David
Unknown2004-12-17 22:08:35
There's still a problem - time warps in Lusternia, as I've seen. Check out this information from Magnagora's revlog 6 weeks ago
2004/11/04 07:10:24 - Stewartsville tithed 14 leather commodities
2004/11/04 17:10:24 - Stewartsville tithed 14 leather commodities
2004/11/05 03:11:38 - Stewartsville tithed 14 leather commodities
Through an analysis of 7 RL days of comm shipments, I got an exact shipment date of 10 hours between Stewartsville shipments of leather, however, if you note: the difference in the latter two shipments is 10 hours, 1 minute, 14 seconds. A 1 minute, 14 second speed bump.
2004/11/04 07:10:24 - Stewartsville tithed 14 leather commodities
2004/11/04 17:10:24 - Stewartsville tithed 14 leather commodities
2004/11/05 03:11:38 - Stewartsville tithed 14 leather commodities
Through an analysis of 7 RL days of comm shipments, I got an exact shipment date of 10 hours between Stewartsville shipments of leather, however, if you note: the difference in the latter two shipments is 10 hours, 1 minute, 14 seconds. A 1 minute, 14 second speed bump.
Unknown2004-12-20 09:59:23
I know, for some reason it doesn't seem to have an effect though..
At least, when I was doing testruns for my algorythm, I always ended up with the correct Lusternian date according to the conversion via DATE.
Or maybe my testruns were messed up
I suggest we call the Temporal Bulldozing Squad and have 'em get rid of those pesky bumps. nyah.
Or maybe all that slavework for Magnagora messed up the Stewardsvillers and they got the time wrong?
At least, when I was doing testruns for my algorythm, I always ended up with the correct Lusternian date according to the conversion via DATE.
Or maybe my testruns were messed up
I suggest we call the Temporal Bulldozing Squad and have 'em get rid of those pesky bumps. nyah.
Or maybe all that slavework for Magnagora messed up the Stewardsvillers and they got the time wrong?
Unknown2004-12-20 15:13:29
It tends to randomly occur every 2-4 days (probably due to lag somewhere).
Unknown2004-12-21 00:08:23
hrm, don't think lag has anything to do with it... it's all happening inside the same machine, no?
If this difference in times only occurs in things like village tithes, maybe they're designed to not be precisely at the same time... would make sense *shrugs*
If this difference in times only occurs in things like village tithes, maybe they're designed to not be precisely at the same time... would make sense *shrugs*