ON OUTCHAT
{
{
;***Set Parameters here***
18 age = ;minimum age
123 rm = ;destination room number, or,
"mypassword" pw = ;password to give out
"rm" action = ;"rm" to move person, "pw" to give out password
;***end of paras***

"$1" GREPSUB ATOI m =
"$2" GREPSUB ATOI d =
"$3" GREPSUB ATOI y =
[ 31 28 31 30 31 30 31 31 30 31 30 31 ] d_in_m =
{ 29 d_in_m 1 PUT } y 4 % NOT IF ;correct for leapyear

{
;birthday in palace days
0 bd =
1970 basis = ;start of Palace time
{ 365 basis 4 % NOT + bd +=
basis ++
} { basis y < } WHILE
[ 0 31 59 90 120 151 181 212 243 273 304 334 ] m 1 - GET d + 1 - bd +=
;today in palace days
21600 tz = ;Eastern: 18000, Central: 21600, Mtn: 25200, Pacific: 28800
1 dst = ;daylight savings time, 1 on 0 off.
{ DATETIME 2085978496 + } { DATETIME tz - dst 3600 * + } DATETIME 0 < IFELSE 86400 / today =
;agecheck (with leapyear adjustment)
{ 1 ok = } { 0 ok = } today bd - age 365 * age 4 / + >= IFELSE
{ rm GOTOROOM } ok action "rm" == AND IF
{ "The password is: " pw & LOCALMSG } ok action "pw" == AND IF
{ "I'm sorry, you are not old enough." LOCALMSG } ok NOT IF
} { "That is not a valid birthdate." LOCALMSG } m DUP SWAP 12 <= AND
d DUP SWAP d_in_m m 1 - GET <= AND AND
y DUP 1900 > SWAP 2003 <= AND AND IFELSE
"" CHATSTR =
} CHATSTR "^([0-9]+)[/]([0-9]+)[/]([0-9]+)" GREPSTR IF
}
ON SELECT
{
"Type your birthday in the format: 4/15/1990" LOCALMSG
}