Basic Scripts

Here are some scripts that perform basic functions:

Turn a variable on (1) and off (0):

{ variable GLOBAL
"$1" GREPSUB "n" == variable =
"Variable " { "on" } { "off" } variable IFELSE & LOGMSG
"" CHATSTR =
} CHATSTR LOWERCASE "^variable o([fn]+)" GREPSTR

 

Turn a variable on (1), off (0) or alternate its state:

{ variable GLOBAL
"$1" GREPSUB command =
{ 1 variable = } command "on" == IF
{ 0 variable = } command "off" == IF
{ variable NOT variable = } command "" == IF
"Variable " { "on" } { "off" } variable IFELSE & LOGMSG
"" CHATSTR =
} CHATSTR "^variable *(.*)" GREPSTR IF

 

Save and restore a person's position:

Place the following in the room (will only work in that room) or at your gate (will work in all rooms):


ON ENTER
{
save_position GLOBAL
{ savedx GLOBAL
savedy GLOBAL
POSX savedx =
POSY savedy =
} save_position DEF


restore_position GLOBAL
{ savedx GLOBAL
savedy GLOBAL
savedx savedy SETPOS
} restore_position DEF
}

When you want to save or restore a persons position use the following:

save_position GLOBAL
save_position EXEC

restore_position GLOBAL
resore_position EXEC

 

Save and restore a person's props:

Place the following in the room (will only work in that room) or at your gate (will work in all rooms):

ON ENTER
{
save_props GLOBAL
{ saved_prop GLOBAL
"[ " p =
0 i =
{ p i USERPROP ITOA & " " & p =
i ++
} { i NBRUSERPROPS < } WHILE
p " ]" & saved_prop =
} save_props DEF

restore_props GLOBAL
{ saved_prop GLOBAL
{ NAKED } { saved_prop STRTOATOM EXEC SETPROPS} "[ ]" saved_prop == IFELSE
} restore_props DEF
}

When you want to save or restore a persons props use the following:

save_props GLOBAL
save_props EXEC


restore_props GLOBAL
restore_props EXEC