@q @program asys-tplates 1 99999 d i ( asys-tplates v1.2 Jessy @ FurryMUCK 6/97, 2/99 asys-tplates runs Argo +template command, which is used during character generation to select a predefined set of Stat and Ability modifications. Templates are defined by the MUCK staff to facilitate and standardize the creation of character types appropriate for the world. INSTALLATION: asys-tplates uses the default Argo installation method. Port and install lib-argo. Set asys-tplates W. Type '+install asys-tplates' to install this program and its action. USAGE: +template.............. Follow prompts to learn select and apply a template. See lib-argo and the Argo manual for further information. asys-tplates 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-tplates" setprop RecOldActions (* create command *) #0 "+templates;+template;+tplates;+tplate" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+templates" scratch @ setprop (* register command *) #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+templates" 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/+templates" 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-tplates (#" prog intostr strcat ")" strcat Tell " " Tell "The " command @ strcat " command allows you to select predefined groups of ability modifica" "tions. Templates are defined by the MUCK staff to facilitate and " "standardize the creation of character types appropriate for this " "world. To use the command, simply type '" command @ "', and follow prompts. You can display a list of available template" "s while using the command." strcat strcat strcat strcat strcat strcat strcat Tell " " Tell "Staff members may also do '" command @ strcat " ' " strcat "to display which templates selected during chargen." strcat Tell " " Tell "See the Argo Manual for further information on templates." Tell ; : DoTPlateList ( -- ) (* display template choices *) " " Tell (* loop through template list; get names; format to 3 cols *) "1" ourCounter ! ourDataObj @ "@a/tplates/" nextprop scratch ! begin (* begin tplate-listing loop *) scratch @ while (* first column *) ourCounter @ 4 LPad ") " strcat scratch @ "" "@a/tplates/" subst dup strlen 1 - strcut pop strcat 24 Pad ourDataObj @ scratch @ nextprop scratch ! ourCounter @ atoi 1 + intostr ourCounter ! scratch @ not if (* second column *) Tell break else ourCounter @ 4 LPad ") " strcat scratch @ "" "@a/tplates/" subst dup strlen 1 - strcut pop strcat strcat 48 Pad ourDataObj @ scratch @ nextprop scratch ! ourCounter @ atoi 1 + intostr ourCounter ! then scratch @ not if (* third column *) Tell break else ourCounter @ 4 LPad ") " strcat scratch @ "" "@a/tplates/" subst dup strlen 1 - strcut pop strcat strcat Tell ourDataObj @ scratch @ nextprop scratch ! ourCounter @ atoi 1 + intostr ourCounter ! then repeat (* end tplate-listing loop *) " " Tell ; : FindNumTPlate ( s -- s i ) (* find skill specified by number in list; return name and T|F *) atoi scratch ! (* store num string as int *) ourDataObj @ "@a/tplates/" nextprop ourCounter ! 0 begin (* begin cat-finding loop *) ourCounter @ not if scratch @ intostr 0 rot pop break then 1 + dup scratch @ = if pop 1 exit then ourDataObj @ ourCounter @ nextprop ourCounter ! repeat (* end cat-finding loop *) ; : DoShowTplates StaffCheck not if ">> Permission denied." Tell exit then ourArg @ .pmatch dup if ">> Templates for " over name strcat ":" strcat Tell dup "@a/tplates" getpropstr dup if ";;" explode 1 - begin (* begin tplate-listing loop *) dup while " " rot strip strcat Tell 1 - repeat (* end tplate-listing loop *) pop pop else " " Tell pop exit then else ">> Player not found." Tell pop exit then ; : DoTemplate ( -- ) (* prompt for tplate; check vals; apply *) ExemptCheck not if ">> Sorry, you cannot select templates after character approval." Tell exit then CheckCGRoom not if ">> Sorry, this command must be used in a designated setup room." Tell exit then begin (* begin tplate-selecting loop *) ">> [Enter name of template, or .l to list choices, or .q to quit]" " effects of a template, you will need to reset completely]" ">> [NOTE: Templates cannot be unselected. In order to undo the" ">> Which template do you want to select?" Tell Tell Tell Tell ReadLine strip QCheck ".list" over stringpfx if DoTPlateList pop continue then (* find specified tplate *) dup number? if FindNumTPlate not if ">> Template not found." Tell pop continue then else CapAll "@a/tplates/" swap strcat "#" strcat dup ourDataObj @ swap getpropstr if ourCounter ! else ">> Template not found." Tell pop continue then then (* check: trying to re-select a tplate? *) me @ "@a/tplates" getpropstr dup if ourCounter @ "" "@a/tplates/" subst dup strlen 1 - strcut pop ";;" strcat instr if ">> Sorry, you have already selected that template." Tell exit then else pop then (* check: user has enough points? *) ourDataObj @ ourCounter @ "/cost" strcat getpropstr atoi me @ "@a/avail/main" getpropstr atoi > if ">> Sorry, you don't have enough points to select this template." Tell continue then (* check: would tplate go over max disads? *) ourDataObj @ ourCounter @ "/dis-ad" strcat getpropstr atoi CheckMaxDisads not if continue then ourDataObj @ ourCounter @ "/" strcat nextprop begin (* begin effect-applying loop *) dup while dup "/cost" instr over "/dis-ad" instr or if ourDataObj @ swap nextprop continue then ourDataObj @ over getpropstr "," explode pop me @ "@a/" rot strcat "/" strcat rot strip CapAll strcat dup "{@a/skills*|@a/spells*|@a/psiabs*|@a/langus*}" smatch if over over "/floor" strcat 5 pick atoi ApplyArgoMod else dup "@a/stats" instr if over over "/floor" strcat 5 pick atoi 8 + ApplyArgoMod then then over over getpropstr atoi 4 rotate atoi + intostr setprop ourDataObj @ swap nextprop repeat (* end effect-applying loop *) pop (* apply costs *) me @ "@a/avail/main" over over getpropstr atoi ourDataObj @ ourCounter @ "/cost" strcat getpropstr atoi - intostr setprop (* apply disad_total *) me @ "@a/disad_total" over over getpropstr atoi Abs ourDataObj @ ourCounter @ "/dis-ad" strcat getpropstr atoi Abs + intostr setprop (* record *) me @ "@a/tplates" getpropstr dup not if pop " " then me @ "@a/tplates" rot ourCounter @ "" "@a/tplates/" subst dup strlen 1 - strcut pop strcat ";;" strcat setprop break repeat (* end tplate-selecting loop *) ourCounter @ "" "@a/tplates/" subst (* record as a class *) "" "#" subst me @ "@a/class/" 3 pick strcat rot setprop ">> Template applied." 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 "#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 else DoShowTplates exit then then me @ ArgoPermCheck Disabled? DeadCheck DoTemplate ; . c q @set asys-tplates=W