@q @program asys-become 1 99999 d i ( asys-become v1.2 Jessy @ FurryMUCK 6/97, 2/99 asys-become runs the Argo +become and +revert commands, used by Argo staff members to become a defined NPC or to revert to their normal form. INSTALLATION: asys-become uses the default Argo installation method. Port and install lib-argo. Set asys-become W. Type '+install asys-become' to install this program and its actions. USAGE: +become = ... Become +revert ........................... Return to your normal form When you become an NPC, all your normal Argo props, as well as your name, desc, sex, and species, are copied to a holding directory, and values for the NPC are substituted in their place. For all practical purposes, your character is rewritten as the NPC. When you revert, all your previous values are restored. You will automatically revert if you disconnect while NPC form. A page alias with your normal name is established when you become an NPC, although it does not work with all versions of the page program. See lib-argo and the Argo manual for further information. asys-skills 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/match 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 ourString (* string: room notification string *) : 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-become" setprop RecOldActions #0 "+become" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+become" scratch @ setprop (* register command *) #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+become" setprop #0 "+revert" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+revert" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+revert" setprop #0 "_disconnect/become" prog setprop prog "L" set ">> 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/+become" RemoveCommand "@a/comm_list/+revert" 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-become (#" prog intostr strcat ")" strcat Tell " " Tell ourCom @ "+become" smatch if "The " command @ strcat " command may be used by a staff member to temporarily become " "an NPC which has been defined for your MUCK." strcat strcat Tell " " Tell "Syntax: " command @ strcat " = ... Become " strcat Tell " " command @ strcat " #list ..................... List available NPCs" strcat Tell " " Tell else "The " command @ strcat " command may be used by a staff member to return to normal form " "after changing into an NPC." strcat strcat Tell " " Tell "Syntax: " command @ strcat Tell " " Tell then "When you become an NPC, all your normal Argo props, as well as your " "name, desc, sex, and species, are copied to a holding directory, and " "values for the NPC are substituted in their place. For all practical " "purposes, your character is rewritten as the NPC. When you revert, " "all your previous values are restored. You will automatically revert " "if you disconnect while NPC form. A page alias with your normal name " "is established when you become an NPC, although it does not work with " "all versions of the page program." strcat strcat strcat strcat strcat strcat strcat Tell ; : DoListNPCs ( s -- ) (* list available npcs *) me @ StaffCheck not if ">> Permission denied." Tell exit then NukeStack ourDataObj @ "@a/npcs/" nextprop dup if begin (* begin npc-fetching loop *) dup while dup "" "@a/npcs/" subst ourDataObj @ rot nextprop repeat (* end npc-fetching loop *) pop depth 3-coln (* display *) else ">> Sorry, no NPCs have been denied for this MUCK." Tell pop then ; : DoRevert ( -- ) (* user reverts to normal form *) (* check: do we have restore info? *) me @ "@a/bin/ep" getprop not if ">> Nothing to restore!" Tell exit then ">> $npc reverts to $player." me @ name "$npc" subst ourString ! (* restore name *) me @ "@name me=" me @ "@a/hold/name" getpropstr strcat " " strcat me @ "@a/bin/ep" getpropstr me @ timestamps pop pop pop me @ atoi + swap strip Encrypt strcat strip force (* restore props *) me @ "npc-desc#" RemoveDir me @ "@a/money/" RemoveDir me @ "@a/stats/" RemoveDir me @ "@a/skills/" RemoveDir me @ "@a/spells/" RemoveDir me @ "@a/psiabs/" RemoveDir me @ "@a/dis-ad/" RemoveDir me @ "@a/langus/" RemoveDir me @ "@a/com/" RemoveDir me @ "@a/bg/" RemoveDir me @ "sex" me @ "@a/hold/sex" getpropstr setprop me @ "species" me @ "@a/hold/species" getpropstr setprop me @ "@a/status" me @ "@a/hold/status" getpropstr setprop me @ "_/de" me @ "@a/hold/desc" getpropstr setprop me @ "@a/hold/stats/" me @ "@a/stats/" MoveDir me @ "@a/hold/skills/" me @ "@a/skills/" MoveDir me @ "@a/hold/spells/" me @ "@a/spells/" MoveDir me @ "@a/hold/psiabs/" me @ "@a/psiabs/" MoveDir me @ "@a/hold/dis-ad/" me @ "@a/dis-ad/" MoveDir me @ "@a/hold/avail/" me @ "@a/avail/" MoveDir me @ "@a/hold/money/" me @ "@a/money/" MoveDir me @ "@a/hold/com/" me @ "@a/com/" MoveDir me @ "@a/hold/bg/" me @ "@a/bg/" MoveDir (* delete page alias *) "page" .noisy_match dup if getlink dup "AliasGlobal-" me @ name strcat remove_prop then ">> You become " me @ name strcat "." strcat Tell (* remove restore info *) me @ "@a/hold/" RemoveDir-r me @ "_connect/asys-become" remove_prop me @ "@a/bin/ep" remove_prop ourString @ me @ name "$player" subst loc @ me @ rot notify_except ; : DoBecome ( -- ) (* user becomes a defined npc *) me @ StaffCheck not if (* check permission *) ">> Permission denied." Tell exit then (* check syntax *) ourArg @ not if ">> Syntax: " command @ strcat " = " strcat Tell exit then ourArg @ "=" instr not if ">> Syntax: " command @ strcat " = " strcat Tell exit then (* store initialization info *) ourArg @ "=" explode pop strip scratch ! me @ timestamps pop pop pop me @ atoi + swap strip Encrypt me @ "@a/bin/ep" rot setprop (* find and verify npc *) scratch @ ourDataObj @ "@a/npcs/" 3 pick strcat "/name" strcat getpropstr not if ">> NPC " swap Capitalize strcat " not found." strcat Tell ">> Done." Tell exit then ">> $player becomes $npc." me @ name "$player" subst over CapAll "$npc" subst ourString ! dup .pmatch if ">> Sorry, a character named " swap Capitalize strcat " is currently in use." strcat Tell ">> Done." Tell exit then dup me @ name smatch if ">> Ummm... you /are/ " swap strcat "!" strcat Tell exit then (* revert to normal if necessary *) me @ "@/hold/name" getpropstr if DoRevert then "@a/npcs/" swap strcat "/" strcat ourCounter ! (* establish page alias *) "page" .noisy_match dup if getlink "AliasGlobal-" me @ name strcat me @ intostr "#" swap strcat setprop else ">> Changing... Note: unable to find the Page program." Tell ">> Pages to the name '" me @ name strcat "' will not go through." strcat Tell pop then (* copy normal state *) me @ "@a/hold/name" me @ name setprop me @ "@a/hold/sex" me @ "sex" getpropstr setprop me @ "@a/hold/species" me @ "species" getpropstr setprop me @ "@a/hold/desc" me @ "_/de" getpropstr setprop me @ "@a/hold/status" me @ "@a/status" getpropstr setprop me @ "@a/stats/" me @ "@a/hold/stats/" MoveDir me @ "@a/skills/" me @ "@a/hold/skills/" MoveDir me @ "@a/spells/" me @ "@a/hold/spells/" MoveDir me @ "@a/psiabs/" me @ "@a/hold/psiabs/" MoveDir me @ "@a/langus/" me @ "@a/hold/langus/" MoveDir me @ "@a/dis-ad/" me @ "@a/hold/dis-ad/" MoveDir me @ "@a/avail/" me @ "@a/hold/avail/" MoveDir me @ "@a/money/" me @ "@a/hold/money/" MoveDir me @ "@a/com/" me @ "@a/hold/com/" MoveDir (* copy npc state *) ourDataObj @ ourCounter @ "stats/" strcat me @ "@a/stats/" CopyDir ourDataObj @ ourCounter @ "skills/" strcat me @ "@a/skills/" CopyDir ourDataObj @ ourCounter @ "spells/" strcat me @ "@a/spells/" CopyDir ourDataObj @ ourCounter @ "psiabs/" strcat me @ "@a/psiabs/" CopyDir ourDataObj @ ourCounter @ "langus/" strcat me @ "@a/langus/" CopyDir ourDataObj @ ourCounter @ "dis-ad/" strcat me @ "@a/dis-ad/" CopyDir ourDataObj @ ourCounter @ "money/" strcat me @ "@a/money/" CopyDir ourDataObj @ ourCounter @ "desc#/" strcat me @ "npc-desc#/" CopyDir ourDataObj @ ourCounter @ "desc#" strcat me @ "npc-desc#" CopyProp me @ "@a/avail/main" "0" setprop me @ "sex" ourDataObj @ ourCounter @ "sex" strcat getpropstr setprop me @ "species" ourDataObj @ ourCounter @ "species" strcat getpropstr setprop me @ "@a/status" "approved" setprop me @ "{eval:{list:npc-desc,this}}{null:{tell:[ {name:me} " "looked at you. ],this}}" strcat setdesc (* change name *) me @ "@name #" me @ intostr strcat "=" strcat ourDataObj @ ourCounter @ "name" strcat getpropstr strcat " " strcat me @ "@a/bin/ep" getpropstr me @ timestamps pop pop pop me @ atoi + swap Encrypt strcat strip force ourCounter @ me @ name ourDataObj @ ourCounter @ "name" strcat getpropstr smatch not if DoRevert exit then (* set disconnect *) me @ "_disconnect/asys-become" prog setprop (* notify *) ">> You become " ourDataObj @ ourCounter @ "name" strcat getpropstr Capitalize strcat "." strcat Tell loc @ me @ ourString @ notify_except ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig if trig "@a/name" getpropstr ourCom ! then ourArg @ if ourArg @ "#" stringpfx if "#help" ourArg @ stringpfx if DoHelp else "#list" ourArg @ stringpfx if DoListNPCs 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 trig if Disabled? then command @ "Queued event." smatch if DoRevert exit then ourCom @ "+become" smatch if DoBecome else DoRevert then ; . c q @set asys-become=W