Code:
Name: 'Time Example', VNum: [ 36], RNum: [ 36]
Trigger Intended Assignment: Mobiles
Trigger Type: Random , Numeric Arg: 1, Arg list: None
Commands:
* By Rumble of The Builder Academy tbamud.com 9091
* A replica of the "time" command.
* Convert hour from 24 hour to 12 hour clock with am/pm
if %time.hour% > 12
eval hour %time.hour% - 12
set ampm pm
else
set hour %time.hour%
set ampm am
end
*
* No 0 hour. Change it to 12.
if %time.hour% == 0
set hour 12
end
*
* Figure out what day (1-35).
switch %time.day%
case 1
case 7
case 14
case 21
case 28
case 35
set day the Day of the Moon
break
case 2
case 8
case 15
case 22
case 29
set day the Day of the Bull
break
case 3
case 9
case 16
case 23
case 30
set day the Day of the Deception
break
case 4
case 10
case 17
case 24
case 31
set day the Day of Thunder
break
case 5
case 11
case 18
case 25
case 32
set day the Day of Freedom
break
case 6
case 12
case 19
case 26
case 33
set day the Day of the Great Gods
break
case 7
case 13
case 20
case 27
case 34
set day the Day of the Sun
break
default
set day I don't know what day it is
break
done
*
* What suffix should we use for the number of the day.
switch %time.day%
case 1
case 21
case 31
set suf st
break
case 2
case 22
case 32
set suf nd
break
case 3
case 23
case 33
set suf rd
break
default
set suf th
break
done
*
* What month are we in (1-17).
set m1 Month of Winter
set m2 Month of the Winter Wolf
set m3 Month of the Frost Giant
set m4 Month of the Old Forces
set m5 Month of the Grand Struggle
set m6 Month of the Spring
set m7 Month of Nature
set m8 Month of Futility
set m9 Month of the Dragon
set m10 Month of the Sun
set m11 Month of the Heat
set m12 Month of the Battle
set m13 Month of the Dark Shades
set m14 Month of the Shadows
set m15 Month of the Long Shadows
set m16 Month of the Ancient Darkness
set m17 Month of the Great Evil
eval months %%m%time.month%%%
*
* My test to make sure my variables are printing out what I expect them to.
* %echo% Hour: %time.hour% Day: %time.day% Month: %time.month% Year: %time.year%
*
* Finally the output.
%echo% It is %hour% o'clock %ampm%, on %day%.
%echo% The %time.day%%suf% Day of the %months%, Year %time.year%.