@q @program asys-background 1 99999 d i ( asys-background v1.2 Jessy @ FurryMUCK 6/97, 2/99 asys-background runs Argo +background;+bg command, which is used to display character's Background. Players can view their own public and private Backgrounds, or another players public Background. Staff members can view the public and private Backgrounds of any player. INSTALLATION: asys-background uses the default Argo installation method. Port and install lib-argo. Set asys-background W. Type '+install asys-background' to install this program and its action. USAGE: +background .... Display background[s] for . See lib-argo and the Argo manual for further information. asys-background may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $enddef $include $lib/argo lvar scratch (* workspace var *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourArg (* inital arg string *) lvar ourOpt (* inital opt string *) 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 (* confirm re-install *) ">> Reinstalling..." Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-background" setprop RecOldActions #0 "+background;+bg" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop (* register command *) #0 "@a/comm_list/+background" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+background" 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/+backgroud" 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-background (#" prog intostr strcat ")" strcat Tell " " Tell "The " command @ strcat " command is used to display characters' Backgrounds. Players can view " "their own public and private Backgrounds, or another player's public " "Background. Staff members can view the public and private Backgrounds " "of any player." strcat strcat strcat strcat Tell " " Tell ">> Syntax: " " " command @ strcat " (staff)..........." 34 strcut pop " Show 's background" strcat strcat Tell " " command @ strcat " #public (staff)..." 34 strcut pop " Show 's public background" strcat strcat Tell " " command @ strcat " #edit ....................." 34 strcut pop " Edit your backgrounds" strcat strcat Tell " " command @ strcat " #notify .........." 34 strcut pop " Turn on|off background notifications" strcat strcat Tell " " Tell " defaults to you... That is, your own backgrounds are displaye" "d if no player is specified." strcat Tell ; : DoLine ( -- ) (* display divider line *) "------------------------------------------------------------------------" Tell ; : DoNotifySyntax ( -- ) (* show #notify syntax *) ">> Syntax: $command #on" command @ "$command" subst Tell " $command #off" command @ "$command" subst Tell ; : DoNotify ( -- ) (* set notifications *) ourOpt @ if ourOpt @ "on" smatch if me @ "@a/bg/notify" "yes" setprop ">> Background notifications on." Tell exit then ourOpt @ "off" smatch if me @ "@a/bg/notify" remove_prop ">> Background notifications off." Tell exit then DoNotifySyntax else DoNotifySyntax then ; : DoEdit ( -- ) (* edit user's public or private background *) ourOpt @ if ourOpt @ "public" stringpfx if "@a/bg/pub" 1 ourBoolean ! then ourOpt @ "private" stringpfx if "@a/bg/pri" 1 ourBoolean ! then then ourBoolean @ not if begin (* begin list-finding loop *) ">> Do you want to edit your Public or your Private background?" Tell ">> [Enter 'public', 'private', or .q to quit]" Tell ReadLine strip QCheck dup "pu" stringpfx if pop "@a/bg/pub" break else dup "pr" stringpfx if pop "@a/bg/pri" break else pop ">> Entry not understood." Tell continue then then repeat (* end list-finding loop *) then me @ swap EditList (* edit list *) ">> Done." Tell ; : DoBackground ( -- ) (* display a player's background[s] *) (* default is user's own *) ourArg @ not if (* default case: user's bg *) DoLine me @ name ", Public Background" strcat Tell DoLine me @ "@a/bg/pub#/" nextprop if me @ "@a/bg/pub" ShowList (* public *) else "" Tell then " " Tell DoLine me @ name ", Private Background" strcat Tell DoLine me @ "@a/bg/pri#/" nextprop if me @ "@a/bg/pri" ShowList (* private *) else "" Tell then DoLine exit then (* display another player's background[s] *) ourArg @ .pmatch dup if dup "@a/bg/notify" getpropstr if dup ">> $player checked your background." me @ name "$player" subst notify then DoLine dup name ", Public Background" strcat Tell DoLine dup "@a/bg/pub#/" nextprop if dup "@a/bg/pub" ShowList (* public *) else "" Tell then StaffCheck ourBoolean @ not and if " " Tell DoLine dup name ", Private Background" strcat Tell DoLine dup "@a/bg/pri#/" nextprop if (* staff can view private bg's as well *) "@a/bg/pri" ShowList else "" Tell then else pop then DoLine else ">> Player " ourArg @ Capitalize strcat " not found." strcat Tell pop then ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! ourArg @ if ourArg @ "#" stringpfx if ourArg @ " " instr dup if ourArg @ swap strcut strip ourOpt ! strip ourArg ! else pop then "#help" ourArg @ stringpfx if DoHelp else "#edit" ourArg @ stringpfx if DoEdit else "#notify" ourArg @ stringpfx if DoNotify 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 "#public" ourArg @ stringpfx if 1 ourBoolean ! ourOpt @ ourArg ! DoBackground exit then ">> #Argument not understood." Tell then then then then then then then then exit then then me @ ArgoPermCheck Disabled? DoBackground ; . c q @set asys-background=W