Page 1 of 2

Need a calendar script! HALP!

Posted: Fri Mar 25, 2016 6:35 pm
by Spyder
Is there a way to create an echo of the time past (wot days) since you last hit the time command?


It is 1 o'clock am, on the 5th day of the month of Saven, year 1105.
(xx days and xx hours have passed since last capture)
According to legend and prophecy, this is the Zunth Turn of the Wheel.
The official forums are now at 'http://forums.wotmud.info' enjoy!

(Server: Fri Mar 25 18:23:14 2016 EST, up for 18 hours, 18 minutes)

Re: Need a calendar script! HALP!

Posted: Mon Mar 28, 2016 1:02 am
by Alison
Why?

Let me think on this. There is a few scripts that capture the month and day.

Re: Need a calendar script! HALP!

Posted: Tue Mar 29, 2016 9:42 am
by Taziar
Need all the names of the months, how many days in each and the order the months go in.

Re: Need a calendar script! HALP!

Posted: Tue Mar 29, 2016 12:20 pm
by Thuvia

Re: Need a calendar script! HALP!

Posted: Thu Apr 07, 2016 1:55 am
by Taziar
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

Re: Need a calendar script! HALP!

Posted: Thu Apr 07, 2016 6:28 am
by Spyder
This is amazing thankyou so much! I've been looking for an easy way to check if a month has passed for use of travel codes etc etc.

This really is awesome, thanks man!

Re: Need a calendar script! HALP!

Posted: Thu Apr 07, 2016 12:55 pm
by Taziar
Hrmm... The way I wrote it it resets every time you type time(it sets the new time as your last look), so if you want it to measure a month or trigger on a certain month or a certain event(like month change) or something I will have to modify it. Let me know.

Edit: also I will have to modify it if you use more than one character and want separate time points saved for each.

Re: Need a calendar script! HALP!

Posted: Sun Apr 10, 2016 12:14 pm
by Taziar
Just thought about this, if you set an alias to type time before you rent then it will be the most accurate.

Code: Select all

#ALIAS rent {
	time
	rent
	}

Re: Need a calendar script! HALP!

Posted: Tue Apr 12, 2016 10:54 am
by Taziar
Fixed typo that wasn't displaying 1 before singular time descriptor. (1 year was showing as only year).

Re: Need a calendar script! HALP!

Posted: Thu Apr 14, 2016 4:58 am
by Taziar
Updated Time script to include greater accuracy on disconnect and connecting.
Added function to save individual time data for each character you connect to the mud with.
Added character deletion notification for characters under level 30.
Must install newest version of ScoreStat script to function properly.

http://www.wotmudarchives.org/forum/vie ... 2618#p2618