Spyder... I don't know why you wanted this, and eventually I am going to make some other options for it I think. (Hope you wanted this for zMUD!)
But, Gheesh!! This was a headache to write... I'm not that great with math and this was by far the most math intensive script I have written.
Glad I did it though, good practice. Hope you like it.
Taziar
Will post in HoM thread on wotmudarchives eventually but here it is for now.
Type helpTime to view help file.
Type showTimeMessage to toggle time message on or off.
First time command entered reads incomplete data.
Time messages after the first will read correctly.
Example: (First time command entered after installing script)
It is 1 o'clock pm, on the 12th day of the month of Adar, year 1107.
According to legend and prophecy, this is the Zunth Turn of the Wheel.
The official forums are now at '
http://forums.wotmud.info' enjoy!
It has been 1107 years, 5 months, 12 days, 13 hours since you last looked.
(Server: Thu Apr 7 01:49:01 2016 EST, up for 1 hour, 44 minutes)
Example: (Shows how hours since last time command will always show, but any other time measurement at 0 does not.)
* HP:Healthy MV:Fresh [Exits:S]> time
It is 1 o'clock pm, on the 12th day of the month of Adar, year 1107.
According to legend and prophecy, this is the Zunth Turn of the Wheel.
The official forums are now at '
http://forums.wotmud.info' enjoy!
It has been 0 hours since you last looked.
(Server: Thu Apr 7 01:49:42 2016 EST, up for 1 hour, 44 minutes)
* HP:Healthy MV:Fresh [Exits:S]> time
It is 2 o'clock pm, on the 12th day of the month of Adar, year 1107.
According to legend and prophecy, this is the Zunth Turn of the Wheel.
The official forums are now at '
http://forums.wotmud.info' enjoy!
It has been 1 hour since you last looked.
(Server: Thu Apr 7 01:50:26 2016 EST, up for 1 hour, 45 minutes)
Message line is an #ECHO and will show years, months, days, and hours since last time command.
Code: Select all
#CLASS {Time}
#ALIAS helpTime {
#SHOW {""}
#SHOW {"-----Time Script-----"}
#SHOW {""}
#SHOW {"First time command entered reads incomplete data."}
#SHOW {"Time messages after the first will read correctly."}
#SHOW {""}
#SHOW {"Type showTimeMessage to toggle time message on/off."}
#SHOW {""}
}
#ALIAS showTimeMessage {
#IF (@showTimeMessage=1) {showTimeMessage=0} {showTimeMessage=1}
#IF (@showTimeMessage=1) {#ECHO {Time message information is turned on.}} {#ECHO {Time message information is turned off.}}
}
#ALIAS timeSetPastData {
#VAR timePastHour {@timeHour}
#VAR timePastAMPM {@timeAMPM}
#VAR timePastDay {@timeDay}
#VAR timePastMonth {@timeMonth}
#VAR timePastYear {@timeYear}
}
#ALIAS timeCalculations {
#MATH timeEvalYears (@timeYear*8736)
#MATH timeEvalMonths (%ismember(@timeMonth,@timeMonthNames)*672)
#MATH timeEvalDays (@timeDay*24)
#IF (@timeAMPM=pm) {#MATH timeEvalHours @timeHour+12} {#MATH timeEvalHours @timeHour}
#IF (@timeHour=12) {#IF (@timeAMPM=am) {#VAR timeEvalHours {0}} {#VAR timeEvalHours {12}}} {}
#MATH timeCurrentTotal (@timeEvalYears+@timeEvalMonths+@timeEvalDays+@timeEvalHours)
#MATH timeEvalPastYears (@timePastYear*8736)
#MATH timeEvalPastMonths (%ismember(@timePastMonth,@timeMonthNames)*672)
#MATH timeEvalPastDays (@timePastDay*24)
#IF (@timePastAMPM=pm) {#MATH timeEvalPastHours @timePastHour+12} {#MATH timeEvalPastHours @timePastHour}
#IF (@timePastHour=12) {#IF (@timePastAMPM=am) {#VAR timeEvalPastHours {0}} {#VAR timeEvalPastHours {12}}} {}
#MATH timePastTotal (@timeEvalPastYears+@timeEvalPastMonths+@timeEvalPastDays+@timeEvalPastHours)
#MATH timeTotalHours (@timeCurrentTotal-@timePastTotal)
#IF (@timeTotalHours > 8736) {
#MATH timeDisplayYear %format(0,%float(@timeTotalHours/8736))
#MATH timeTotalMonths (@timeTotalHours-(@timeDisplayYear*8736))
} {#VAR timeDisplayYear {0}
#VAR timeTotalMonths @timeTotalHours
}
#IF (@timeTotalMonths > 672) {
#MATH timeDisplayMonth %format(0,%float(@timeTotalMonths/672))
#MATH timeTotalDays (@timeTotalMonths-(@timeDisplayMonth*672))
} {#VAR timeDisplayMonth {0}
#VAR timeTotalDays @timeTotalMonths
}
#IF (@timeTotalDays > 24) {
#MATH timeDisplayDay %format(0,%float(@timeTotalDays/24))
#MATH timeDisplayHour (@timeTotalDays-(@timeDisplayDay*24))
} {#VAR timeDisplayDay {0}
#VAR timeDisplayHour {@timeTotalDays}
}
}
#VAR showTimeMessage {1}
#VAR timeMonthNames {Taisham|Jumara|Saban|Aine|Adar|Saven|Amadaine|Tammaz|Maigdhal|Choren|Shaldine|Nesan|Danu}
#VAR timeCurrentTotal {0}
#VAR timePastTotal {0}
#VAR timeTotalMonths {0}
#VAR timeTotalHours {0}
#VAR timeTotalDays {0}
#VAR timeTotalYears {0}
#VAR timeEvalDays {0}
#VAR timeEvalHours {0}
#VAR timeEvalMonths {0}
#VAR timeEvalYears {0}
#VAR timeEvalPastDays {0}
#VAR timeEvalPastHours {0}
#VAR timeEvalPastMonths {0}
#VAR timeEvalPastYears {0}
#VAR timeHour {0}
#VAR timeAMPM {}
#VAR timeDay {0}
#VAR timeMonth {}
#VAR timeYear {0}
#VAR timePastHour {0}
#VAR timePastAMPM {}
#VAR timePastDay {0}
#VAR timePastMonth {}
#VAR timePastYear {0}
#VAR timeDisplayHour {0}
#VAR timeDisplayDay {0}
#VAR timeDisplayMonth {0}
#VAR timeDisplayYear {0}
#TRIGGER {It is &%dtimeHour o'clock &%wtimeAMPM, on the &%d{timeDay}{st|nd|rd|th} day of the month of &%wtimeMonth, year &%dtimeYear.} {
timeCalculations
timeSetPastData
}
#TRIGGER {The official forums are now at 'http://forums.wotmud.info' enjoy!} {
#IF (@showTimeMessage=1) {#ECHO {It has been %if(@timeDisplayYear>1,@timeDisplayYear years~," ","")%if(@timeDisplayYear=1,1 year~," ","")%if(@timeDisplayMonth>1,@timeDisplayMonth months~," ","")%if(@timeDisplayMonth=1,1 month~," ","")%if(@timeDisplayDay>1,@timeDisplayDay days~," ","")%if(@timeDisplayDay=1,1 day~," ","")%if(@timeDisplayHour>0,@timeDisplayHour hour,"0 hours")%if(@timeDisplayHour>1,"s "," ")since you last looked.}} {}
}
#COND {$} {#IF (@showTimeMessage=1) {#GAG} {}}
#CLASS 0