@q @program asys-stop 1 99999 d i ( asys-stop v1.2 Jessy@FurryMUCK 6/97, 11/99 This command is used to cancel any pending combat, magic,or psionics actions. Normally, a player uses it to stop his own actions, simply by typing '+stop'. Staff members may also use it to stop all actions in the room, by typing '+stop #all'. INSTALLATION: asys-stop uses the standard Argo installation method. Port the program and set it Wizard. Type '+install asys-stop' USAGE: Typing '+stop' cancels all combat, magic, and psionics event loops. Typing '+stop #all' cancels all event loops for all players in the room. asys-stop may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $enddef $include $lib/argo $include $lib/reflist lvar scratch (* workspace var *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourArg (* inital arg string, unmodified *) lvar ourCom (* string: 'official' name of command *) lvar ourBoolean (* int: misc flow control var *) : DoInstall ( -- ) (* install program into Argo system *) caller program? not if (* confirm installation method *) ">> Programs must be installed via the " "+install" GetCommandName strcat " command." strcat Tell exit then prog "@a/version" getpropstr if ">> Reinstalling..." Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-stop" setprop RecOldActions (* create and register command; set default props *) #0 "+stop" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+stop" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+stop" setprop #0 "+pause" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+pause" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+pause" setprop #0 "+unpause" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+unpause" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+unpause" setprop ">> Installed." Tell ; : DoUninstall (* uninstall program from Argo *) prog "@a/name" getpropstr if #0 "@a/prog_list/" prog "@a/name" getpropstr strcat getprop not if ">> " prog name strcat " is not currently installed." strcat Tell pid kill then else ">> " prog name strcat " is not currently installed." strcat Tell pid kill then ">> Please confirm: You wish to uninstall " prog name strcat "?" strcat Tell ReadYesNo not if ">> Aborted." Tell pid kill Then background "@a/comm_list/+stop" RemoveCommand "@a/comm_list/+pause" RemoveCommand "@a/comm_list/+unpause" RemoveCommand #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop RecOldActions #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoPauseHelp ( -- ) (* display +pause|+unpause help screen *) "The $pause command is used to pause all Argo events in a room. " "While events are paused, all settings remain in effect, but no " "actions are taken. The $unpase command resumes events. These " "commands may be available only to staff members, depedning on " "Argo system settings." strcat strcat strcat strcat "+pause" GetCommandName "$pause" subst "+unpause" GetCommandName "$unpause" subst Tell " " Tell ; : DoStopHelp ( -- ) (* display +stop help screen *) "This command is used to cancel any pending combat, magic,or " "psionics actions." strcat Tell " " Tell "Normally, a player uses it to stop his own actions, simply by " "typing '$com'. Staff members may also use it to stop all actions " "in the room, by typing '$com #all'." strcat strcat command @ "$com" subst Tell ; : DoHelp ( -- ) (* display help screen *) " " Tell prog name " (#" strcat prog intostr strcat ")" strcat Tell " " Tell ourCom @ "+stop" smatch if DoStopHelp exit then ourCom @ "+pause" smatch if DoPauseHelp exit then ourCom @ "+unpause" smatch if DoPauseHelp exit then ; : DoStopLoops ( -- ) ourCounter @ "@a/eloop/pid" over over getprop kill pop remove_prop ourCounter @ "@a/eloop/act" remove_prop ourCounter @ "@a/eloop/acting" remove_prop ourCounter @ "@a/eloop/genmod" remove_prop ourCounter @ "@a/eloop/speedmod" remove_prop ourCounter @ "@a/eloop/target" remove_prop ourCounter @ "@a/invisible" getpropstr if ourCounter @ "@a/invisible" remove_prop ourCounter @ "!D" set #0 "@a/reveal" ourCounter @ REF-delete then ourCounter @ scratch @ notify ; : DoStop ( -- ) me @ ourCounter ! ">> Stopped." scratch ! DoStopLoops me @ "@a/stats/con_mod" getpropstr atoi 0 > if me @ "@a/stats/con_mod" "0" setprop then me @ "@a/stats/dex_mod" getpropstr atoi 0 > if me @ "@a/stats/dex_mod" "0" setprop then me @ "@a/stats/int_mod" getpropstr atoi 0 > if me @ "@a/stats/int_mod" "0" setprop then me @ "@a/stats/pre_mod" getpropstr atoi 0 > if me @ "@a/stats/pre_mod" "0" setprop then me @ "@a/stats/str_mod" getpropstr atoi 0 > if me @ "@a/stats/str_mod" "0" setprop then ; : DoStopAll ( -- ) StaffCheck not if ">> Permission denied." Tell exit then ">> $name stops all Argo events." me @ name "$name" subst scratch ! loc @ contents begin dup while dup ourCounter ! DoStopLoops next repeat ; : DoPause ( -- ) (* pause argo events in the room *) ourDataObj @ "@a/sysparms/player_pause" getpropstr "no" smatch if StaffCheck not if ">> Permission denied." Tell exit then then me @ location "@a/eloop/pause" "yes" setprop ">> $me pauses Argo events." me @ name "$me" subst TellRoom ; : DoUnPause ( -- ) (* unpause argo events in the room *) ourDataObj @ "@a/sysparms/player_pause" getpropstr "no" smatch if StaffCheck not if ">> Permission denied." Tell exit then then me @ location "@a/eloop/pause" remove_prop ">> $me resumes Argo events." me @ name "$me" subst TellRoom ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! Update ourArg @ if ourArg @ "#" stringpfx if "#help" ourArg @ stringpfx if DoHelp else "#all" ourArg @ stringpfx if DoStopAll else "#enable" ourArg @ stringpfx if DoEnable else "#disable" ourArg @ stringpfx if DoDisable else "#version" ourArg @ stringpfx if DoVersion else "#install" ourArg @ stringpfx if DoInstall else "#uninstall" ourArg @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then then then then then exit then then me @ ArgoPermCheck Disabled? ourCom @ "+stop" smatch if DoStop exit then ourCom @ "+pause" smatch if DoPause exit then ourCom @ "+unpause" smatch if DoUnPause exit then ">> ERROR: Command not found." Tell ; . c q @set asys-stop=W