@q @program asys-skills 1 99999 d i ( asys-skills v1.2 Jessy @ FurryMUCK 6/97, 2/99 asys-skills runs Argo +skills command, which is used to modify a character's skill levels. INSTALLATION: asys-skills uses the default Argo installation method. Port and install lib-argo. Set asys-skills W. Type '+install asys-skills' to install this program and its action. USAGE: +skills................ Follow prompts to learn new skills or modify existing ones 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 lvar scratch (* workspace var *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourArg (* inital arg string, unmodified *) lvar ourOption (* string: command #option *) lvar ourString (* string: job prop *) 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 prog "@a/name" "asys-realm" setprop RecOldActions #0 "+skills" 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/+skills" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop #0 "@a/cat_list/skills" "Skill" setprop scratch @ "@a/name" "+skills" setprop (* set desc to show help *) scratch @ "{muf:#" prog intostr strcat "," strcat "#help}" strcat setdesc ">> Installed." Tell ; : DoUninstall (* uninstall program from Argo *) ">> Please confirm: You wish to uninstall " prog name strcat "?" strcat Tell ReadLine not if ">> Aborted." Tell pid kill Then background "@a/comm_list/+skills" RemoveCommand #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop RecOldActions ">> Uninstalled." Tell ">> Please edit the online manual as appropriate." Tell ; : DoHelp ( -- ) (* display help screen *) " " Tell "asys-skills \(#" prog intostr strcat "\)" strcat Tell " " Tell "The " command @ strcat " command is used to modify your skill levels, by spending character " "points to learn new skills or improve existing ones. To use it, type " strcat strcat command @ strcat " and follow prompts. As with any prompt-driven Argo command, you can " "speak and pose while at a prompt, but cannot enter other MUCK commands" strcat strcat Tell " " Tell "You can also use the $info command to get information about a " "specific skill. See `$info #help'." strcat "+info" GetCommandName "$info" subst Tell " " Tell ; : FindNamedSkill ( s -- s i ) (* find skill specified by name; return name and T|F *) ourDataObj @ "@a/skills/" 3 pick strcat getpropstr if CapAll 1 else CapAll 0 then ; : SetSkill ( s -- ) (* adjust user's level for skill s *) (* check: user has points to spend *) me @ "@a/avail/main" getpropstr atoi 0 > not me @ "@a/status" getpropstr "na" smatch not and if ">> Sorry, you don't have any points to spend on skills." Tell ">> Done." Tell pop pid kill then (* check: user has perqs? *) dup me @ "skills" 3 pick CheckPerqs not if ">> Sorry, you don't have the prerequisites for that skill." Tell pop exit then (* check: user has required Intelligence? *) me @ "@a/stats/int" getpropstr atoi ourDataObj @ "@a/skills/" 4 pick strcat getpropstr "," explode pop pop swap pop atoi dup rot > if ">> Sorry, your Intelligence must be " swap intostr strcat " to learn " strcat swap strcat "." strcat Tell exit else pop then (* check: user has status necessary for group influence? *) dup "* Influence" smatch if ourDataObj @ "@a/groups/" 3 pick dup strlen 10 - strcut pop strcat "/SR" strcat over over getpropstr if getpropstr atoi me @ "@a/dis-ad/status" getpropstr atoi > if ">> Sorry, your Status must be higher to have Influence in the " swap dup strlen 10 - strcut pop strcat " group." strcat Tell then else pop pop then then (* find out how many levels user wants *) begin (* begin level-asking loop *) ">> How many levels of the " over strcat " skill do you want to add?" strcat Tell ">> [Enter a number between " me @ "@a/status" getpropstr dup "na" smatch swap "exempt" smatch or if me @ "@a/skills/" 4 pick strcat getpropstr atoi dup if 0 swap - me @ "@a/skills/" 5 pick strcat "/floor" strcat getpropstr atoi + intostr else pop "1" then else "1" then strcat " and " strcat me @ "@a/avail/main" getpropstr strcat ", or .q to quit]" strcat Tell ReadLine strip QCheck (* check: valid entry? *) dup number? not if ">> Sorry, that's not a number." Tell pop continue then (* check: negative level? *) me @ "@a/skills/" 4 pick strcat getpropstr atoi over atoi + 0 < if ">> Sorry, you cannot have a negative skill level." Tell pop continue then (* check: approved player trying to lower? *) me @ "@a/status" getpropstr dup "na" smatch swap "exempt" smatch or not if dup atoi 1 < if ">> Sorry, you must specify at least one additional level." Tell pop continue then then (* check: would current mod go below floor? *) dup atoi 0 < if me @ "@a/skills/" 4 pick strcat "/floor" strcat getpropstr dup if me @ "@a/skills/" 5 pick strcat getpropstr atoi 3 pick atoi + swap atoi < if pop pop ">> Sorry, that would violate a prerequisite or " "template dependency." strcat Tell exit then else pop then then atoi dup me @ "@a/avail/main" getpropstr atoi > if ">> Sorry, you don't have enough points for that." Tell pop exit then (* check: user has enough money? *) ourDataObj @ "@a/skills/" 4 pick strcat getpropstr "," explode pop pop pop atoi over * dup if me @ swap CheckFunds not if ">> Sorry, you don't have enough money to learn that skill." Tell pop exit then else pop then break (* passed all tests! *) repeat (* end level-asking loop *) (* set floor if skill has preqs & this is 1st time learning, or if user is reducing ability level *) me @ "@a/skills/" 4 pick strcat getpropstr not if ourDataObj @ "@a/skills/" 4 pick strcat "/preqs#/" strcat over over nextprop dup if begin (* begin preq-floor-setting loop *) dup while ourDataObj @ over getpropstr "," explode 3 = not if ">> ERROR." Tell ">> There is an error with this skill's prerequisites." Tell ">> Please contact a staff member." Tell ">> Skill not set." Tell exit then "@a/" swap strcat "/" strcat swap Capitalize strcat "/floor" strcat me @ swap over over getpropstr atoi 4 rotate atoi + intostr setprop ourDataObj @ swap nextprop repeat (* end preq-floor-setting loop *) pop pop pop else pop pop pop then then ourDataObj @ "@a/skills/" 4 pick strcat getpropstr "," explode pop pop pop atoi over * dup if me @ swap Charge not if ">> Error with monetary cost: Please contact a staff member." Tell exit then else pop then me @ "@a/avail/main" over over getpropstr atoi 4 pick - intostr setprop me @ "@a/skills/" 4 pick strcat over over getpropstr atoi 4 rotate + intostr setprop (* remove floors that no longer apply *) me @ "@a/skills/" 3 pick strcat getpropstr atoi 0 <= if ourDataObj @ "@a/skills/" 3 pick strcat "/preqs#/" strcat nextprop dup if begin (* begin floor-removing loop *) dup while ourDataObj @ over getpropstr "," explode pop me @ "@a/" rot strcat "/" strcat rot strcat "/floor" strcat over over 5 rotate atoi 0 swap - ApplyArgoMod over over getpropstr atoi 0 <= if (* strip floors <= 0 *) remove_prop else pop pop then ourDataObj @ swap nextprop repeat (* end floor-removing loop *) pop else pop then then ">> Your ability level for " over strcat " is now " strcat me @ "@a/skills/" 4 pick strcat getpropstr strcat "." strcat Tell (* strip skills <= 0 *) me @ "@a/skills/" rot strcat over over getpropstr atoi 0 <= if remove_prop else pop pop then ; : DoSkills ( -- ) (* enter interactive session; adjust skills *) (* check: location ok? *) CheckCGRoom not if ">> Sorry, this command must be used in a designated setup room." Tell exit then (* check: skills defined? *) ourDataObj @ "@a/skills/" nextprop not if ">> Sorry, no skills have been entered for this realm." Tell exit then (* get name of skill *) begin (* begin skill-reading loop *) ">> You have $num available character $noun." me @ "@a/avail/main" getpropstr dup scratch ! "$num" subst scratch @ "1" smatch if "point" else "points" then "$noun" subst Tell ">> What skill do you wish to learn?" Tell ">> [Enter a skill, or .l to list choices, or .q to quit]" Tell ReadLine strip QCheck dup ".l" smatch if "@a/skills/" 3-coln-prop continue then dup number? if "@a/skills/" swap FindNumProp dup not if ">> Sorry, there is no skill with that number." Tell pop continue then else FindNamedSkill not if ">> Sorry, there is no skill named " swap strcat "." strcat Tell continue then then SetSkill repeat (* end skill-reading loop *) ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! ourArg @ if ourArg @ "#" stringpfx if ourArg @ " " instr if ourArg @ dup " " instr strcut strip ourArg ! strip ourOption ! else ourArg @ strip ourOption ! then "#help" ourOption @ stringpfx if DoHelp else "#enable" ourOption @ stringpfx if DoEnable else "#disable" ourOption @ stringpfx if DoDisable else "#version" ourOption @ stringpfx if DoVersion else "#install" ourOption @ stringpfx if DoInstall else "#uninstall" ourOption @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then then then then exit then then me @ ArgoPermCheck Disabled? DeadCheck DoSkills ; . c q @set asys-skills=W