@q @program asys-control 1 99999 d i ( asys-control v1.2 Jessy@FurryMUCK 6/00 INSTALLATION: asys-control uses the standard Argo installation method. Port the program and set it Wizard. Type '+install asys-control' USAGE: asys-control may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.1" $define Tell me @ owner swap notify $enddef $include $lib/argo $include $lib/reflist lvar ourArg (* inital arg string, unmodified *) lvar ourBoolean (* int: misc flow control var *) lvar ourCom (* string: 'official' name of command *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourOption (* string: command #option *) lvar ourTarget (* dbref: puppet to be controlled *) lvar scratch (* workspace 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-control" setprop RecOldActions (* create and register command; set default props *) #0 "+control;+cont" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+control" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+control" 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/+control" RemoveCommand #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop RecOldActions ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoHelp ( -- ) (* display help screen *) " " Tell prog name " (#" strcat prog intostr strcat ")" strcat Tell " " Tell "The $com command is used to control Argo-enabled puppets. To use " "it, you must first designate a $com target. You may target a " "puppet if either (1) you own it, (2) you are an Argo staff member, " "or (3) a spell or ability Has temporarily given you the ability " "to control it." strcat strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax:" Tell " " Tell " $com #target .... Set as your control target" command @ "$com" subst Tell " $com ............ Force current target to do " command @ "$com" subst Tell " " Tell ; : DoTarget ( -- ) (* set a +control target *) ourArg @ not if ">> Syntax: $com #target ... Sets control target" command "$com" subst Tell ">> $com ........... Forces target to do " command "$com" subst Tell exit then ourArg @ match dup #-1 dbcmp if ">> I don't see that here." Tell exit then dup #-2 dbcmp if ">> Ambiguous. I don't know which one you mean!" Tell exit then dup #-3 dbcmp if ">> I don't see that here." Tell exit then dup thing? over "Z" flag? and not if ">> Permission denied." Tell exit then ourTarget ! StaffCheck me @ ourTarget @ controls or ourTarget @ "@a/eloop/controlled" me @ REF-inlist? or not if ">> Permission denied." Tell exit then ourTarget @ "@a/version" getpropstr not if ">> $name is not Argo-enabled." ourTarget @ name "$name" subst Tell exit then me @ "@a/eloop/controlling" getprop dup if "@a/eloop/controlled" me @ REF-delete me @ "@a/eloop/controlled" remove_prop then ourTarget @ "@a/eloop/controlled" me @ REF-add me @ "@a/eloop/controlling" ourTarget @ setprop ">> Set." Tell ; : DoControl ( -- ) ourArg @ not if ">> Syntax: $com #target ... Sets control target" command "$com" subst Tell ">> $com ........... Forces target to do " command "$com" subst Tell exit then me @ "@a/eloop/controlling" getprop dup if ourTarget ! else ">> You don't have a control target selected." Tell exit then ourTarget @ ok? not if ">> You don't have a valid control target selected." Tell exit then StaffCheck ourTarget @ "@a/eloop/controlled" me @ REF-inlist? or not if ">> Permission denied." Tell exit then ourTarget @ "@a/version" getpropstr not if ">> $name is not Argo-enabled." ourTarget @ name "$name" subst Tell exit then ourTarget @ ourArg @ force ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! Update ourArg @ if ourArg @ "#" stringpfx if ourArg @ " " instr if ourArg @ dup " " instr strcut strip ourArg ! strip ourOption ! else ourArg @ strip ourOption ! then "#help" ourOption @ stringpfx if DoHelp else "#enable" ourOption @ stringpfx if DoEnable else "#target" ourOption @ stringpfx if DoTarget else "#disable" ourOption @ stringpfx if DoDisable else "#version" ourOption @ stringpfx if DoVersion else "#install" ourOption @ stringpfx if DoInstall else "#uninstall" ourOption @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then then then then then exit then then me @ ArgoPermCheck Disabled? DoControl ; . c q @set asys-control=W