@@ Some general rules: @@ @@ Any line which, like this, begins with @@, is a comment and should NOT @@ be pasted into your MUSH @@ @@ If you already have a global object like a WHO Machine, then you can @@ just stick this code onto it instead of making up a whole new object @@ @@ Commands: @@ * +time: This command shows the current MUSH time (usually referred @@ to as "IC" or "In-Character" time on most RP MUSHes. It also shows @@ "time around the world". This can be modified for Daylight @@ savings time. @@ @@ * +time/zone *: Will allow you to set your 'local' time zone to @@ Eastern, Central, Mountain, or Pacific time, either Daylight @@ savings or Standard. (If you are in another zone, you will @@ have to figure out and set the TIME_FACTORS attribute yourself.) @@ @@ Code details: @@ @@ @@ This will create 1 object. To make it global, place it in the master @@ room. The final line of the file below is VERY important -- it makes @@ sure all of the various attributes other than the two $-commands are @@ set no_command, which saves on lag. @@ @@ @@ Disclaimer: I don't really support this code in any way. It's not @@ really coded like this at all on Champions MUSH... I had to simplify @@ it to make it standardized to work anywhere. Because these commands @@ already exist as globals on CM, I can't test them on a global object @@ the way I probably should. All I can say is, use at your own risk. If @@ you have problems you can email me, but I will not make any guarantees @@ that I'll have time to help. I will if I can; if not... you're on @@ your own. @@ @@ Coded by Steven @ Champions MUSH @@ @create Digital Clock @set Digital Clock=safe @set Digital Clock=!no_command @lock Digital Clock==me @link Digital Clock=#2 &CMD_TIME_ZONE Digital Clock=$+time/zone *: @switch/first strmatch(%#,owner(me))=0,{@pemit %#=You are not allowed to do that!},{@switch/first match([setq(0,lattr(me/time_factors_*))]%q0,TIME_FACTORS_%0)=0,{@pemit %#=That is not a valid TimeZone. Choose from: [iter(%q0,%b[extract(##,3,1,_)], ,\,)]},{@pemit %#=You set the Digital Clock's time zone to: [ucstr(%0)]; @cpattr me/time_factors_%0=me/time_factors}} &CMD_+TIME Digital Clock=$+time: @pemit %#=[ansi(hy,center(\[ [mudname()] Digital Clock \],76,-))]%r%r[ansi(hw,Current [mudname()] time:)] \[ [ansi(hr,time())] \]%r%r[u(tz_function,secs())]%r[ansi(hy,repeat(-,76))] &TZ_FUNCTION Digital Clock=[center(ansi(hc,repeat(*,12)),76)]%rTime Around the World:%r%b[iter([setq(0,v(time_zones))]%q0,[ljust(ansi(hg,##:),14)]%b[rjust(u(timeconv_fun, secs(),##),21)]%b[switch(mod(match(%q0,##,|),2),0,%r)],|)] &TIMECONV_FUN Digital Clock=[u(hours,[extract([setq(1,convsecs(add(mul(extract(v(time_factors),match(v(time_zones),%1,|),1,|),3600),%0)))]%q1,4,1)])],%b[extract(%q1,1,1)],%b[extract(%q1,2,2)] &HOURS Digital Clock=[ifelse(gt(first(%0,:),12),sub(first(%0,:),12),first(%0,:))]:[extract(%0,2,1,:)]%b[ifelse(gte(first(%0,:),12),PM,AM)] &TIME_ZONES Digital Clock=Eastern Time|Central Time|Mountain Time|Pacific Time|Hawaii|London|Tokyo|Sydney &TIME_FACTORS_EST Digital Clock=0|-1|-2|-3|-5|5|14|15 &TIME_FACTORS_EDT Digital Clock=0|-1|-2|-3|-6|4|13|14 &TIME_FACTORS_CST Digital Clock=1|0|-1|-2|-4|6|15|16 &TIME_FACTORS_CDT Digital Clock=1|0|-1|-2|-5|5|14|15 &TIME_FACTORS_MST Digital Clock=2|1|0|-1|-3|7|16|17 &TIME_FACTORS_MDT Digital Clock=2|1|0|-1|-4|6|15|16 &TIME_FACTORS_PST Digital Clock=3|2|1|0|-2|8|17|18 &TIME_FACTORS_PST Digital Clock=3|2|1|0|-3|7|16|17 @dolist setdiff(lattr(Digital Clock),CMD_TIME_ZONE CMD_+TIME)={@set Digital Clock/##=no_command}