@q @program bell.muf 1 99999 d i (2345678901234567890123456789012345678901234567890123456789012345678901) $include $lib/reflist $define Tell me @ swap notify $enddef lvar ourString (* string: formatted message string *) : DoAdminPerm? ( -- ) (* check: admin permission? *) trig owner me @ dbcmp me @ "W" flag? or not if "Permission denied." pid kill then ; : DoHelp ( -- ) (* show help screen *) " " Tell prog name " (#" strcat prog intostr strcat ")" strcat Tell " " Tell "A simple utility that notifies players in a list with a configured " "message string." strcat Tell " " Tell "Syntax:" Tell " " Tell " $command .................. Send default message to registered players" command @ "$command" subst Tell " $command <mesg> ........... Send <mesg> to registered players" command @ "$command" subst Tell " $command #add <player> .... Add <player> to registered list (admin)" command @ "$command" subst Tell " $command #remove <player> . Remove <player> from registered list (admin)" command @ "$command" subst Tell " $command #message <mesg> .. Set default message to <mesg> (admin)" command @ "$command" subst Tell " $command #message ......... Clear default message (admin)" command @ "$command" subst Tell " $command #public .......... Set action public (admin)" command @ "$command" subst Tell " $command #!public ......... Set action not-public (admin)" command @ "$command" subst Tell " " Tell "Wizards and the owner of the trigger action have admin permission. " "Anyone can add or remove themselves from a public action. If the " "action is not public, only admins can add or remove players." strcat strcat Tell ; : DoAdd DoAdminPerm? dup " " instr if dup " " instr strcut swap pop .pmatch dup #-1 dbcmp if "Player not found." Tell exit then dup #-2 dbcmp if "Ambiguous. I don't know who you mean!" Tell exit then trig "_list" 3 pick REF-add name " added to notification list." strcat Tell else "Syntax: $command #add <player> command @ "$command" subst Tell then ; : DoRemove DoAdminPerm? dup " " instr if dup " " instr strcut swap pop .pmatch dup #-1 dbcmp if "Player not found." Tell exit then dup #-2 dbcmp if "Ambiguous. I don't know who you mean!" Tell exit then trig "_list" 3 pick REF-delete name " removed from notification list." strcat Tell else "Syntax: $command #remove <player> command @ "$command" subst Tell then ; : DoMessage DoAdminPerm? dup " " instr if dup " " instr strcut swap pop trig "_message" 3 pick setprop "Message set to `" swap strcat "'." strcat Tell else trig "_message" remove_prop "Message cleared." Tell then ; : DoPublic DoAdminPerm? trig "_public" "yes" setprop "Action set public." Tell ; : DoNotPublic DoAdminPerm? trig "_public" remove_prop "Action set not-public." Tell ; : DoBell trig "_message" getpropstr dup if ourString ! else pop "%n rings the bell." ourString ! then me @ ourString @ pronoun_sub ourString ! dup if ourString @ " \"" strcat swap strcat "\"" strcat ourString ! then trig "_list" REF-allrefs begin dup while swap dup me @ dbcmp if pop else ourString @ notify then 1 - repeat pop me @ ourString @ notify ; : main "me" match me ! dup if dup "#h*" smatch if DoHelp else dup "#a*" smatch if DoAdd else dup "#r*" smatch if DoRemove else dup "#m*" smatch if DoMessage else dup "#p*" smatch if DoPublic else dup "#!p*" smatch if DoNotPublic else DoBell then then then then then then else DoBell then ; . c q