@q @program asys-puppets 1 99999 d i (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $enddef $include $lib/argo lvar ourArg (* inital arg string, unmodified *) lvar ourCom (* string: 'official' name of command *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) 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 (* confirm re-install *) ">> Reinstalling..." Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-puppets" setprop RecOldActions #0 "+puppets" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+puppets" scratch @ setprop (* register command *) #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+puppets" setprop ">> Installed." Tell ; : DoUninstall (* uninstall program from Argo *) ">> Please confirm: You wish to uninstall " prog name strcat "?" strcat Tell ReadLine not if ">> Aborted." Tell pid kill Then background "@a/comm_list/+puppets" 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 "asys-puppets \(#" prog intostr strcat "\)" strcat Tell " " Tell "This staff-only command enables and disables puppets for use with " "the Argo system." strcat Tell " " Tell "Syntax: " Tell " " Tell " " command @ strcat " = yes ..... " strcat "Enables for Argo" strcat Tell " " command @ strcat " = no ...... " strcat "Disables for Argo" strcat Tell " " Tell ; : DoPuppets ( -- ) (* enable or disable a puppet for Argo *) StaffCheck not if ">> Permission denied." Tell exit then ourArg @ "=" instr if ourArg @ "=" explode pop else ">> Syntax: " command @ strcat " = " strcat Tell exit then match dup #-1 dbcmp if ">> Puppet not found." Tell exit then dup #-2 dbcmp if ">> Ambiguous. I don't know which one you mean." Tell exit then dup "Z" flag? not if ">> " swap name strcat " is not a puppet." Tell exit then swap "yes" over stringpfx if pop dup "@a/enabled" "yes" setprop ">> " swap name strcat " is now Argo-enabled." strcat Tell exit then "no" over stringpfx if pop dup "@a/enabled" remove_prop ">> " swap name strcat " is now Argo-disabled." strcat Tell else ">> Syntax: " command @ strcat " = " strcat Tell then ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! ourArg @ if ourArg @ "#" stringpfx if "#help" ourArg @ stringpfx if DoHelp 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 exit then then DoPuppets ; . c q @set asys-puppets=W