@q @program asys-list 1 99999 d i ( asys-list v1.2 Jessy @ FurryMUCK 6/97, 2/99 asys-list runs the Argo +list command, which is used to view lists of entries in the Argo database. INSTALLATION: asys-list uses the default Argo installation method. Port and install lib-argo. Set asys-list W. Type '+install asys-list' to install this program and its action. USAGE: +list ...... Display entries for +list #categories ..... Display the list of categories Possible entry categores are: Advantages CharGen Rooms Commands Creatures Disadvantages Docs Groups Items Jobs NPCs Objects Programs Psiabs Skills Spells Staff Templates Categories which are not applicable on your MUCK -- either because no entries have been defined or because the relevant systems have been disabled -- will not appear in the category list. You may also list object classes. It is not necessary to type the whole category name: you only need to enter enough characters to specify a unique choice. If you do not supply a category, Argo will prompt you for one; the category list is available at the prompt. Advantages and disadvantages appear in a combined list. See lib-argo and the Argo manual for further information. asys-list 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 *) lvar ourBoolean (* int: 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-list" setprop RecOldActions #0 "+list" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+list" scratch @ setprop (* register command *) #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+list" 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/+xxx" 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-list (#" prog intostr strcat ")" strcat Tell " " Tell "The " command @ strcat " command is a general-purpose tool for listing entries in the Argo " "database. Some possible entry categories are: " strcat strcat Tell " " Tell " Templates" " Psiabs Skills Spells " " NPCs Objects Programs " " Groups Items Jobs" " Creatures Disadvantages Docs " " Advantages CharGen Rooms Commands" Tell Tell Tell Tell Tell Tell " " Tell "Syntax: " command @ strcat " .... Display entries for " strcat Tell " " command @ strcat " #categories ... Display the list of categories" strcat Tell " " Tell "Available categories may not include all entries shown here, " "since some categories may undefined or disabled on your MUCK. " "It is not necessary to type the whole category name: you only " "need to enter enough characters to specify a unique choice. " "If you do not supply a category, Argo will prompt you for one; " "the category list is available at the prompt. You may also list " "classes of objects." strcat strcat strcat strcat strcat strcat Tell ; : DoClasses ( -- ) (* show list of object classes *) "@a/temp/" me @ intostr strcat "/" strcat scratch ! ourDataObj @ scratch @ RemoveDir-r NukeStack begin depth while ourDataObj @ scratch @ 3 pick strcat rot setprop repeat ourDataObj @ "@a/objects/" nextprop dup if begin dup while ourDataObj @ over "/class/" strcat nextprop begin dup while dup dup "/" rinstr strcut swap pop dup ourDataObj @ scratch @ rot CapAll strcat rot CapAll setprop ourDataObj @ swap nextprop repeat pop ourDataObj @ swap nextprop repeat pop else pop then ourDataObj @ scratch @ 2-coln-prop ourDataObj @ scratch @ RemoveDir-r ; : DoListByClass ( s -- ) (* list objects with class s *) "@a/temp/" me @ intostr strcat "/" strcat scratch ! ">> OBJECTS OF CLASS " over toupper strcat ":" strcat Tell ourDataObj @ "@a/objects/" nextprop begin dup while ourDataObj @ over "/class/" strcat 4 pick strcat getpropstr if dup "" "@a/objects/" subst dup ourDataObj @ scratch @ rot strcat rot setprop 1 ourBoolean ! then ourDataObj @ swap nextprop repeat pop ourDataObj @ scratch @ 2-coln-prop ; : DoCategories ( -- ) (* show list of available categories *) 0 ourBoolean ! NukeStack ">> Available Categories:" Tell " " Tell (* put titles of cats on stack *) ourDataObj @ "@a/dis-ad/" nextprop if 1 ourBoolean ! "Advantages" then ourDataObj @ "@a/cg_locs" getpropstr if "CharGen Rooms" then ourDataObj @ "@a/objects/" nextprop if "Classes" then #0 "@a/comm_list/" nextprop if "Commands" then ourDataObj @ "@a/dis-ad/" nextprop if "Disadvantages" then #0 "@a/docs/" nextprop if "Docs" then ourDataObj @ "@a/groups/" nextprop if "Groups" then ourDataObj @ "@a/jobs/" nextprop if "Jobs" then ourDataObj @ "@a/npcs/" nextprop if "NPCs" then ourDataObj @ "@a/objects/" nextprop if "Objects" then #0 "@a/prog_list/" nextprop if "Programs" then ourDataObj @ "@a/psiabs/" nextprop ourDataObj @ "@a/sysparms/psionics" getpropstr "yes" smatch and if "Psiabs" then ourDataObj @ "@a/skills/" nextprop if "Skills" then ourDataObj @ "@a/spells/" nextprop ourDataObj @ "@a/sysparms/magic" getpropstr "yes" smatch and if "Spells" then ourDataObj @ "@a/staff/members" getpropstr if "Staff" then ourDataObj @ "@a/tplates/" nextprop if "Templates" then ourDataObj @ "@a/sup_cat_list/" nextprop begin dup while dup "" "@a/sup_cat_list/" subst CapAll ourDataObj @ rot nextprop repeat pop (* display categories *) Depth 3-col " " Tell (* display some command notes *) ">> It is not necessary to type the whole category name: you only " Tell " need to type enough characters to specify a unique choice." Tell ourBoolean @ if ">> Note: Advantages and Disadvantages appear in the same list" Tell then ; : ShowByRefList ( s -- ) (* show entries for cat stored in a reflist *) ourDataObj @ swap getpropstr dup if strip " " explode (* put dbref of entries on stack *) begin (* quick and dirty sorting: set entries as props on a temporary propdir *) dup while swap strip "" "#" subst atoi dbref name ourDataObj @ "@a/temp/" me @ intostr strcat "/" strcat rot strcat 1 setprop 1 - repeat pop (* display entries in temp propdir *) "@a/temp/" me @ intostr strcat "/" strcat dup 2-coln-prop ourDataObj @ swap RemoveDir-r (* remove temp propdir *) " " Tell ">> Done." Tell else " " Tell " " Tell " " Tell then ; : DoList ( -- ) (* display entries for a dbase category *) ourDataObj @ "@a/temp/" me @ intostr strcat "/" strcat RemoveDir-r begin ourArg @ dup not if (* get category if needed *) pop DoCategories ">> What do you want to list?" Tell ">> [Enter category, or .q to quit]" Tell ReadLine strip QCheck then (* check: user wants to see list of cats *) dup ".c" smatch if DoCategories "" ourArg ! continue then (* object classes are subdirs; handle separately *) "classes" over stringpfx if ">> OBJECT CLASSES:" Tell DoClasses exit then (* staff and chargen rooms are reflists; handle separately *) "staff" over stringpfx if NukeStack ">> STAFF:" Tell "@a/staff/members" ShowByRefList exit then "chargen rooms" over stringpfx if NukeStack ">> CHARGEN ROOMS:" Tell "@a/cg_locs" ShowByRefList exit then 0 ourBoolean ! (* all others, put title and relevant propdir on stack *) "Advantages" over stringpfx if "DIS-AD" "@a/dis-ad/" else "Creatures" over stringpfx if "CREATURES" "@a/creatures/" else "Commands" over stringpfx if "COMMANDS" "@a/comm_list/" else "Disadvantages" over stringpfx if "DIS-AD" "@a/dis-ad/" else "Docs" over stringpfx if "DOCS" "@a/docs/" else "Groups" over stringpfx if "GROUPS" "@a/groups/" else "Jobs" over stringpfx if "Jobs" "@a/jobs/" else "NPCs" over stringpfx if "NPCs" "@a/npcs/" else "Programs" over stringpfx if "PROGRAMS" "@a/prog_list/" else "Psiabs" over stringpfx if "PSIABS" "@a/psiabs/" else "Objects" over stringpfx if "OBJECTS" "@a/objects/" else "Skills" over stringpfx if "SKILLS" "@a/skills/" else "Spells" over stringpfx if "SPELLS" "@a/spells/" else "Templates" over stringpfx if "TEMPLATES" "@a/tplates/" else "Classes" over stringpfx if DoClasses exit else #0 "@a/calls/list" 3 pick strcat getprop dup if "#list " rot strcat swap call exit else pop then DoListByClass ourBoolean @ if exit then ">> Category not found." Tell pop "" ourArg ! continue then then then then then then then then then then then then then then then (* dis-ads and items/mats are combined list; make title reflect this *) rot pop swap dup "DIS-AD" smatch if pop "ADVANTAGES and DISADVANTAGES" then swap (* check: category disabled? *) swap dup "IT-MAT" smatch if pop "ITEMS and MATERIALS" ourDataObj @ "@a/weapons/" nextprop if 1 ourBoolean ! then then swap dup "@a/prog_list/" smatch if ">> CURRENTLY INSTALLED ARGO PROGRAMS:" Tell NukeStack #0 "@a/prog_list/" nextprop dup if begin dup while #0 over getprop name #0 rot nextprop repeat pop depth 3-coln else " " Tell then ">> Done." Tell exit then (* command names include aliases, so handle specially *) dup "@a/comm_list/" smatch if ">> ARGO COMMANDS:" Tell NukeStack #0 "@a/comm_list/" nextprop begin dup while #0 over getprop dup dbref? if name dup ";" instr if dup ";" instr 1 - strcut pop then swap else pop then #0 swap nextprop repeat pop depth 3-coln exit then (* check: category disabled? *) dup "@a/spells/" smatch ourDataObj @ "@a/sysparms/magic" getpropstr "yes" smatch not and if ">> Magic is currently disabled." Tell pop pop exit then dup "@a/psiabs/" smatch ourDataObj @ "@a/sysparms/psionics" getpropstr "yes" smatch not and if ">> Psionics are currently disabled." Tell pop pop exit then (* display cat title *) ">> " rot strcat ":" strcat Tell (* display entries *) 2-coln-prop " " Tell ourBoolean @ if ">> See also '" command @ strcat " weapons'" strcat Tell then break repeat ">> Done." Tell ; : 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 "#categories" ourArg @ stringpfx if DoCategories 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 Disabled? DoList ; . c q @set asys-list=W