@q @program asys-medics 1 99999 d i ( asys-medics v1.2 Jessy@FurryMUCK 6/00 Asys-medics controls use of the two standard Argo medical skills, Medic and Physician. INSTALLATION: asys-medics uses the standard Argo installation method. Port the program and set it Wizard. Type '+install asys-medics' USAGE: +use at|on|vs asys-medics may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $enddef $define VerifyEvent caller #0 "@a/calls/eventloop" getprop dbcmp not if ">> This routine must be called from asys-eventmgr." me @ swap notify 0 exit then $enddef $include $lib/argo lvar ourArg (* inital arg string, unmodified *) lvar ourBoolean (* int: misc flow control var *) lvar ourCom (* string: 'official' name of command *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourTarget (* dbref: player to heal *) lvar scratch (* workspace 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 ">> Reinstalling..." Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-medics" setprop prog "@a/version" ArgoVersion setprop RecOldActions #0 "@a/prog_list/asys-medics" prog setprop #0 "@a/calls/usemedic" prog setprop #0 "@a/calls/usephysician" prog setprop #0 "@a/skills/Medic/tools/medical equipment" "1" setprop #0 "@a/skills/Medic" "cra,9,0" setprop #0 "@a/skills/Physician/nodef" "yes" setprop #0 "@a/skills/Physician/preqs#/1" "skills,medic,1" setprop #0 "@a/skills/Physician/preqs#" "1" setprop #0 "@a/skills/Physician/tools/medical equipment" "1" setprop #0 "@a/skills/Physician" "cra,11,0" 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 #0 "@a/calls/usemedic" remove_prop #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoTellWait ( -- ) (* set user's action to 'wait' and notify *) me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop ">> Your current action is 'wait'." Tell ; : DoCheckMedTime ( -- i ) (* return true if user is eligible to use healing skills on ourTarget again. Based on sysparm heal_interval *) ourDataObj @ "@a/sysparms/heal_interval" getpropstr ParseTimeString pop ourCounter ! ourTarget @ "@a/healing" getprop dup if systime < if 1 else 0 then else pop 1 then ; : DoCheckMedTarget ( -- i ) (* return true if med skills can be used on @a/eloop/target *) me @ "@a/eloop/target" getprop ourTarget ! ourTarget @ location me @ location dbcmp not if 0 exit then ourTarget @ "@a/version" getpropstr not if 0 exit then ourTarget @ "@a/stats/stun" getpropstr if 0 exit then ourTarget @ me @ dbcmp not if ourTarget @ "@a/eloop/act" getpropstr dup if "{wait|rest}" smatch not if 0 exit then else pop then then 1 ; : DoChecks ( -- i ) (* verify target can be healed *) VerifyEvent me @ "@a/eloop/target" getprop not if ">> You don't have a valid target." Tell me @ "@a/eloop/target" remove_prop 0 exit then me @ "@a/eloop/target" getprop ok? not if ">> You don't have a valid target." Tell me @ "@a/eloop/target" remove_prop 0 exit then DoCheckMedTarget not if ">> You can't work on $name right now." ourTarget @ name "$name" subst Tell 0 exit then DoCheckMedTime not if ">> More time needs to pass before you can work on $name again." ourTarget @ name "$name" subst Tell 0 exit then 1 ; : DoCheckDamMin ( -- ) (* make sure we haven't 'over healed' *) ourTarget @ "@a/stats/dam" getpropstr dup if atoi 0 <= if ourTarget @ "@a/stats/dam" remove_prop then else pop then ; : DoPhysicianCritSucc ( -- )(* apply results of physician crit succ *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 1 6 0 Dice me @ "@a/skills/physician" GetModAbility + 2 * - intostr setprop DoCheckDamMin ">> $me's attempt to heal $you succeeds. [CRITICAL SUCCESS]" me @ name "$me" subst ourTarget @ name "$you" subst TellRoom me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop me @ RollXPs ; : DoPhysicianCritFail ( -- )(* apply results of physician crit fail *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice + intostr setprop ">> $me's attempt to heal $you fails. [CRITICAL FAILURE]" me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ourTarget @ CheckDeath me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop ; : DoPhysicianNormSucc ( -- )(* apply results of physician norm succ *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 1 ourDataObj @ "@a/sysparms/tech_level" getpropstr atoi 0 Dice 1 4 0 Dice + me @ "@a/skills/physician" GetModAbility + - intostr setprop DoCheckDamMin ">> $me's attempt to heal $you succeeds." me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ; : DoPhysicianNormFail ( -- )(* apply results of physician norm fail *) ">> $me's attempt to heal $you fails." me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ; : DoPhysician ( -- ) (* use physician skill *) DoChecks not if DoTellWait exit then ourTarget @ "@a/stats/dam" getpropstr not if ">> $target is uninjured." ourTarget @ name "$target" subst Tell DoTellWait exit then ">> $me attempts to give $you medical aid..." me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi 15 * sleep DoChecks not if exit then ourTarget @ "@a/stats/dam" getpropstr not if ">> $target is uninjured." ourTarget @ name "$target" subst Tell DoTellWait exit then "@a/skills/physician/tools/" Tools? not if ">> You no longer have the necessary " "tools for the Physician skill." strcat me @ "@a/store/veron" getpropstr if me @ "@a/store/verstring" getpropstr strcat then NukeStack exit then "@a/skills/physician/materials/" Materials? not if ">> You no longer have the necessary " "materials for the Physician skill." strcat me @ "@a/store/veron" getpropstr if me @ "@a/store/verstring" getpropstr strcat then NukeStack exit then "@a/skills/physician/materials" UseMaterials me @ "@a/skills/medic" GetModAbility "skills/medic" GetBase dup "phy" smatch if pop me @ GetPhysSkill atoi else dup "cra" smatch if pop me @ GetCraftSkill atoi else me @ "@a/stats/" rot strcat GetModAbility then then me @ "@a/eloop/genmod" getpropstr atoi + + ourTarget @ "@a/invisible" getpropstr if 8 - then me @ "@a/skills/physician" GetModAbility if 3 else 4 then 6 0 Dice dup 4 <= if pop pop DoPhysicianCritSucc exit then dup 17 >= if pop pop DoPhysicianCritFail exit then >= if DoPhysicianNormSucc else DoPhysicianNormFail then ourTarget @ "@a/healing" ourDataObj @ "@a/sysparms/heal_interval" getpropstr ParseTimeString pop systime + setprop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop me @ "@a/eloop/target" remove_prop NukeStack ; : DoMedicCritSucc ( -- ) (* apply results of medic crit succ *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice 2 * - intostr setprop DoCheckDamMin ">> $me's attempt to heal $you succeeds. [CRITICAL SUCCESS]" me @ name "$me" subst ourTarget @ name "$you" subst TellRoom me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop me @ RollXPs ; : DoMedicCritFail ( -- ) (* apply results of medic crit fail *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 1 2 0 Dice + intostr setprop ">> $me's attempt to heal $you fails. [CRITICAL FAILURE]" me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ourTarget @ CheckDeath me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop ; : DoMedicNormSucc ( -- ) (* apply results of medic norm succ *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice - intostr setprop DoCheckDamMin ">> $me's attempt to heal $you succeeds." me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ; : DoMedicNormFail ( -- ) (* apply results of medic norm fail *) ">> $me's attempt to heal $you fails." me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ; : DoMedic ( -- ) (* use medic skill *) DoChecks not if DoTellWait exit then ourTarget @ "@a/stats/dam" getpropstr not if ">> $target is uninjured." ourTarget @ name "$target" subst Tell DoTellWait exit then ">> $me attempts to give $you medical aid..." me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi 5 * sleep DoChecks not if exit then ourTarget @ "@a/stats/dam" getpropstr not if ">> $target is uninjured." ourTarget @ name "$target" subst Tell DoTellWait exit then "@a/skills/medic/tools/" Tools? not if ">> You no longer have the necessary " "tools for the Medic skill." strcat me @ "@a/store/veron" getpropstr if me @ "@a/store/verstring" getpropstr strcat then NukeStack exit then "@a/skills/medic/materials/" Materials? not if ">> You no longer have the necessary " "materials for the Medic skill." strcat me @ "@a/store/veron" getpropstr if me @ "@a/store/verstring" getpropstr strcat then NukeStack exit then "@a/skills/medic/materials" UseMaterials me @ "@a/skills/medic" GetModAbility "skills/medic" GetBase dup "phy" smatch if pop me @ GetPhysSkill atoi else dup "cra" smatch if pop me @ GetCraftSkill atoi else me @ "@a/stats/" rot strcat GetModAbility then then me @ "@a/eloop/genmod" getpropstr atoi + + ourTarget @ "@a/invisible" getpropstr if 8 - then me @ "@a/skills/medic" GetModAbility if 3 else 4 then 6 0 Dice dup 4 <= if pop pop DoMedicCritSucc exit then dup 17 >= if pop pop DoMedicCritFail exit then >= if DoMedicNormSucc else DoMedicNormFail then ourTarget @ "@a/healing" ourDataObj @ "@a/sysparms/heal_interval" getpropstr ParseTimeString pop systime + setprop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop me @ "@a/eloop/target" remove_prop NukeStack ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! Update ourArg @ if ourArg @ "#" stringpfx if "#usemedic" ourArg @ smatch if DoMedic else "#usephysician" ourArg @ smatch if DoPhysician else "#install" ourArg @ stringpfx if DoInstall else "#uninstall" ourArg @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then then exit then then ; . c q @set asys-medics=W