Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
roncli
Wanderer


Joined: 07 Sep 2002
Posts: 63
Location: USA

PostPosted: Sun Jan 19, 2003 12:57 pm   

Achaea Date and Time Script
 
The following is a complete script that actually keeps track of the in-game date and time in the status bar. This assumes a 24-hour clock, and automatically adjusts for lag 6 times per Achaean day. Note that the date is a short date, and the clock is in military time. To initialize this script, enter the command DATE in Achaea (I do it every time I log in), and then wait for the first adjustment reset (can be up to 15 minutes, but will usually be quicker). Every 30 seconds real time is equivalent to 12 minutes Achaean time.

#CLASS {Time}
#ALIAS ADDTODATE {#add DateMinute 12;#if (@DateMinute >= 60) {#add DateHour 1;#var DateMinute "00"}}
#ALIAS UPDATEDATE {#var DateYear %3;#var DateDay %1;#if (%2 = "Sarapin") { #var DateMonth 1};#if (%2 = "Daedalan") { #var DateMonth 2};#if (%2 = "Aeguary") { #var DateMonth 3};#if (%2 = "Miraman") { #var DateMonth 4};#if (%2 = "Scarlatan") { #var DateMonth 5};#if (%2 = "Ero") { #var DateMonth 6};#if (%2 = "Valnuary") { #var DateMonth 7};#if (%2 = "Lupar") { #var DateMonth 8};#if (%2 = "Phaestian") { #var DateMonth 9};#if (%2 = "Chronos") { #var DateMonth 10};#if (%2 = "Glacian") { #var DateMonth 11};#if (%2 = "Mayan") { #var DateMonth 12}}
#VAR DateYear {0}
#VAR DateDay {0}
#VAR DateHour {0}
#VAR DateMinute {00}
#VAR DateMonth {0}
#TRIGGER {It is now the (%d)* of (*), (*) years after} {#var DateHour 0;#var DateMinute "00";UPDATEDATE %1 %2 %3;#untrigger 30 Time;#alarm 30 {ADDTODATE} Time}
#ALARM 30 {ADDTODATE}
#TRIGGER {Today is the (%d)* of (*), (*) years after} {UPDATEDATE %1 %2 %3}
#TRIGGER {With nary a whisper nor a sigh, rosy-fingered dawn creeps into the land,} {#var DateHour 4;#var DateMinute 48;#untrigger 30 Time;#alarm 30 {ADDTODATE} Time}
#TRIGGER {Casting off her final fetters, the luminous lady awakens fully, shedding her} {#var DateHour 8;#var DateMinute 48;#untrigger 30 Time;#alarm 30 {ADDTODATE} Time}
#TRIGGER {Attaining her fullest glory, the shining sun sits upon her throne at the apex} {#var DateHour 12;#var DateMinute "00";#untrigger 30 Time;#alarm 30 {ADDTODATE} Time}
#TRIGGER {Balancing on the rim of the world, Lady Sol prepares to enter her daily} {#var DateHour 18;#var DateMinute "00";#untrigger 30 Time;#alarm 30 {ADDTODATE} Time}
#TRIGGER {The stars wink into existence, familiar constellations illuminating the night} {#var DateHour 20;#var DateMinute 48;#untrigger 30 Time;#alarm 30 {ADDTODATE} Time}
#STAT {@DateMonth/@DateDay/@DateYear @DateHour:@DateMinute}
#CLASS 0


-roncli
Reply with quote
Spartacus
Wanderer


Joined: 23 Apr 2001
Posts: 53
Location: USA

PostPosted: Mon Mar 07, 2005 9:27 pm   
 
Roncli,

This looks really cool, but rather than using 12 nested ifs in your UPDATEDATE alias, might I suggest using %item()?

Code:
#ALIAS UPDATEDATE {
  #var DateYear %3
  #var DateDay %1
  #VAR DateMonth {%ismember(%2, Sarapin|Daedalan|Aeguary|Miraman|Scarlatan|Ero|Valnuary|Lupar|Phaestian|Chronos|Glacian|Mayan)}
}

If nothing else it makes it a little more readable, IMO.
_________________
Spartacus
rm -rf .*
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net