def abs ( int -- int' } Returns the absolute value of the given integer. ) (\n) dup 0 < if -1 * then ( int' ) def singlespace ( str -- str' } Change all runs of multiple spaces in the given string to single spaces. ) (\n) begin dup " " instr while ( str ) (\n\t) " " " " subst ( str' ) (\n) repeat ( str' ) def notify_except_nospam ( dbRoom dbPlayer strMessage -- } Notify everyone in the given room, except the given player and anyone who's _nospam?:yes, of the given string. ) (\n) 1 swap .notify_exclude_nospam ( ) def notify_exclude_nospam ( dbRoom dbP1..dbPn intN strMessage -- } Notify everyone in the given room, except the given players and anyone who's _nospam?:yes, of the given string. ) (\n) ( Fetch dbRoom; that's intN plus three {intN, strMessage, and down one more}. ) (\n) over 3 + pick ( dbRoom dbP1..dbPn intN strMessage dbRoom ) (\n\n) ( Loop through its contents. ) (\n) contents begin dup ok? while ( dbRoom dbP1..dbPn intN strMessage dbContained ) (\n\t) ( Is this object _nospam?:yes? ) (\n\t) dup "_nospam?" getpropstr .yes? if ( dbRoom dbP1..dbPn intN strMessage dbContained ) (\n\t\t) ( Yes; add it to the exclusion list. ) (\n\t\t) dup -4 rotate ( dbRoom dbP1..dbPn dbContained intN strMessage dbContained ) (\n\t\t) rot 1 + -3 rotate ( dbRoom dbP1..dbPn' intN' strMessage dbContained } dbContained is the new dbPn, and intN is incremented. ) (\n\t) then ( dbRoom dbP1..dbPn intN strMessage dbContained ) (\n) next repeat pop ( dbRoom dbP1..dbPn intN strMessage ) (\n\n) ( Notificate. ) (\n) notify_exclude ( ) def tell ( str -- } Notify the user of the given string. ) (\n) me @ swap notify def otell ( str -- } Notify everyone in the room except the current user of the given string. ) (\n) loc @ me @ rot notify_except def alltell ( str -- } Notify everyone in the room {including the user} of the given string. ) (\n) loc @ 0 rot notify_exclude def popall ( .. -- } Removes everything on the stack. ) (\n) begin depth while pop repeat ( ) def popn ( ??N..??1 intN -- } Removes a list of intN items {ie, the top intN+1 things} from the stack. ) (\n) dup 0 > if begin dup while ( ??N..??1 intN ) (\n\t) swap pop ( ??N..??2 intN ) (\n) 1 - repeat then pop ( } Putting the pop outside the if-then means the intN gets popped even if it was 0 or negative. ) def wiz? ( db -- bool } Returns true if the given dbref has wizardly powers {ie, has a wizbit and isn't Quelled}. ) (\n) dup "W" flag? if ( db ) (\n\t) "Q" flag? not ( bool ) (\n) else pop 0 then ( bool ) def wizard? ( db -- bool } Returns true if the given dbref has a wizbit. ) (\n) "Wizard" flag? ( bool ) def yes? ( str -- bool } Returns true if str starts with 'y' or '1'. ) (\n) dup if (\n\t) 1 strcut pop ( str- ) (\n\t) dup tolower "y" strcmp if ( str- ) (\n\t\t) "1" strcmp not ( bool ) (\n\t) else pop 1 then ( bool ) (\n) else pop 0 then ( bool ) def no? ( str -- bool } Returns true if str is null, or starts with 'n' or '0'. ) (\n) dup if (\n\t) 1 strcut pop ( str- ) (\n\t) dup "n" strcmp if ( str- ) (\n\t\t) "0" strcmp not ( bool ) (\n\t) else pop 1 then ( bool ) (\n) else pop 0 then ( bool )