@q @program asys-staff 1 99999 d i ( asys-staff v1.2 Jessy @ FurryMUCK 6/97, 2/99 asys-skills runs Argo +skills command, which is used to display a list of Argo staff members. Staff members may use it to toggle their duty status, set a 'specialty' string, or format the screen's appearance. Wizards may use it to add and remove Argo staff members. INSTALLATION: asys-staff uses the default Argo installation method. Port and install lib-argo. Set asys-staff W. Type '+install asys-staff' to install this program and its action. USAGE: +staff ............ Show staff members +staff #on ........ Go on duty +staff #off ....... Go off duty +staff #specialty.. Set a specialty string +staff #add ....... Add a player to staff roster +staff #remove .... Remove a player from staff roster +staff #format .... Format display screen See lib-argo and the Argo manual for further information. PROGRAMMING NOTE: MUCKers may note that this is a perfect opportunity to use lib-reflist, but that I haven't used it. I have found that lib-reflist does not compile reliably: macros -- not always supplied with the code to the library -- are required for all lib-reflist functions to work. Rather than including measures to explain or remedy this, I chose to simply duplicated the needed lib-reflist functions in this program. asys-staff 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, unmodified *) lvar ourCom (* string: 'official' name of command *) : 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-staff" setprop RecOldActions #0 "+staff" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+staff" scratch @ setprop (* register command *) #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+staff" 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/+staff" 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-staff (#" prog intostr strcat ")" strcat Tell " " Tell "The " command @ strcat " command is use to display Argo staff members and their current " "duty status. Staff members may also use it to go on and off duty, " "and to set a 'specialty' string. Wizards may use it to add and re" "move players from the staff roster." strcat strcat strcat strcat Tell " " Tell "Syntax: " command @ strcat " ............ Show staff members" strcat Tell " " command @ strcat " #on ........ Go on duty " strcat Tell " " command @ strcat " #off ....... Go off duty " strcat Tell " " command @ strcat " #specialty.. Set a specialty string " "" strcat strcat Tell " " command @ strcat " #add ....... Add a player to staff " "roster " strcat strcat Tell " " command @ strcat " #remove .... Remove a player from " "staff roster " strcat strcat Tell " " command @ strcat " #format .... Format display screen " "" strcat strcat Tell " " Tell "As with all Argo commands, it is not necessary to type the " "#argument string completely: you only need to type the first one " "or several characters, enough to distinguish the option you want " "from the others." strcat strcat strcat Tell ; : DoFormat ( -- ) (* format screen's header and trailer *) ">> Edit material to be shown at top of staff screen:" Tell #0 "@a/staff/header" EditList ">> Edit material to be shown at bottem of staff screen:" Tell #0 "@a/staff/trailer" EditList ">> Done." Tell ; : DoAdd ( -- ) (* prompt wiz user for a player to add to staff *) me @ "W" flag? not if (* check permission *) ">> Permission denied." Tell exit then (* get player *) ">> Who do you want to add to the Argo staff?" Tell ">> [Enter player name, or .q to quit]" Tell ReadLine strip QCheck (* if valid entry, add to staff *) .pmatch dup if dup intostr "#" swap strcat " " strcat #0 "@a/staff/members" over over getpropstr 4 pick instr if pop pop pop ">> " swap name strcat " is already a staff member." strcat Tell ">> Done." Tell exit else (* if duplicate entry, notify and quit *) over over getpropstr 4 rotate strcat setprop dup "@a/staff" "yes" setprop ">> " swap name strcat " added to staff." strcat Tell ">> Done." Tell then else (* if invalid entry, notify and quit *) ">> Player not found." Tell then ; : DoRemove ( -- )(* prompt wiz user for player to remove from staff *) StaffCheck not if (* check permission *) ">> Permission denied." Tell exit then (* get player *) ">> Who do you want to remove from the Argo staff?" Tell ">> [Enter player name, or .q to quit]" Tell ReadLine strip QCheck (* if valid entry, remove from staff *) .pmatch dup if dup intostr "#" swap strcat " " strcat #0 "@a/staff/members" over over getpropstr 4 pick instr if over over getpropstr 4 rotate "" swap subst setprop dup "@a/staff" remove_prop dup "@a/staff/offduty" remove_prop dup "@a/staff/spec" remove_prop ">> " swap name strcat " removed from staff." strcat Tell ">> Done." Tell exit else (* if invalid entry, notify and quit *) pop pop pop ">> " swap name strcat " is now not a staff member." strcat Tell ">> Done." Tell then else ">> Player not found." Tell then ; : DoOnDuty ( -- ) (* user goes on duty *) me @ "@a/staff/offduty" remove_prop ">> You go on duty." Tell ; : DoOffDuty ( -- ) (* user goes off duty *) me @ "@a/staff/offduty" "yes" setprop ">> You go off duty." Tell ; : DoSpecialty ( -- ) (* prompt for and set user's specialty string *) ">> What is your Argo specialty or staff tag line?" Tell ">> [Enter string, .r to remove current string, or .q to quit]" Tell ReadLine strip QCheck dup ".r" smatch if me @ "@a/staff/spec" remove_prop pop else me @ "@a/staff/spec" rot setprop then ">> Set." Tell ; : DoStaff ( -- ) (* display staff screen *) (* display header if present *) #0 "@a/staff/header" ShowList (* get reflist of staff members *) #0 "@a/staff/members" getpropstr dup if " " explode 1 - begin (* begin staff-listing loop *) dup while swap strip 1 strcut swap pop atoi dbref dup name 14 Pad over awake? if over "@a/staff/offduty" getpropstr if "[off-duty] " else "[ on-duty] " then strcat else "[--------] " strcat then swap "@a/staff/spec" getpropstr strcat 76 strcut pop Tell (* show one line *) 1 - repeat (* end staff-listing loop *) pop else pop "" Tell then (* display trailer if present *) #0 "@a/staff/trailer" ShowList ; : 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 "#on" ourArg @ stringpfx if DoOnDuty else "#off" ourArg @ stringpfx if DoOffDuty else "#specialty" ourArg @ stringpfx if DoSpecialty else "#add" ourArg @ stringpfx if DoAdd else "#remove" ourArg @ stringpfx if DoRemove else "#format" ourArg @ stringpfx if DoFormat 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 then then then then then exit then then me @ ArgoPermCheck Disabled? DoStaff ; . c q @set asys-staff=W