@q @program asys-ppp 1 99999 d i ( *YOUR HEADER COMMENT HERE* Please do include a header comment. They're important. See other Argo programs for examples. USING ASYS-XPSIABS: Modify this program as needed to add new Argo psiabs. Begin by searching and replacing all instances of the string 'ppp' with the name of your program. Search and replace all instances of the string 'xxx' with the name of the psiab. Code that handles effects of the psiab should be placed in function Do. See the Argo Manual for further discussion. See asys-stdpsiabs for examples. You may freely copy and modify functions from asys-stdpsiabs for inclusion in this program. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.1" $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: misc 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 (* notify that we're starting... *) prog "@a/version" getpropstr if ">> Reinstalling..." Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-ppp" setprop prog "@a/version" ArgoVersion setprop RecOldActions #0 "@a/prog_list/asys-ppp" prog setprop #0 "@a/calls/focusxxx" prog setprop ">> Installed." Tell ; : DoUninstall (* uninstall program from Argo *) (* check: is program installed? *) 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 (* check: is program installed? *) ">> Please confirm: You wish to uninstall " prog name strcat "?" strcat Tell ReadYesNo not if ">> Aborted." Tell pid kill Then #0 "@a/calls/focusxxx" remove_prop #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoTargetLoop ( -- ) (* start an event loop for target if needed *) ourTarget @ thing? not ourTarget @ player? not and if exit then ourTarget @ "@a/eloop/pid" getprop dup if ispid? not if ourTarget @ "@a/eloop/quell_tell" "yes" setprop ourTarget @ "+wait" force ourTarget @ "@a/eloop/quell_tell" remove_prop then else ourTarget @ "@a/eloop/quell_tell" "yes" setprop ourTarget @ "+wait" force ourTarget @ "@a/eloop/quell_tell" remove_prop pop then ; : DoChecks ( -- i ) (* verify target can be healed *) me @ "@a/eloop/target" getprop not if (* make sure target is ok *) ">> You don't have a valid target." VerTell me @ "@a/eloop/target" remove_prop 0 exit then me @ "@a/eloop/target" getprop ok? not if ">> You don't have a valid target." VerTell me @ "@a/eloop/target" remove_prop 0 exit then ourDataObj @ "@a/psiabs/$psiab/nonlocal" ourPsiab @ "" "@a/psiabs/" subst "$psiab" subst getpropstr not if me @ "@a/eloop/target" getprop room? not if me @ "@a/eloop/target" getprop location me @ location dbcmp not me @ "@a/eloop/target" getprop location me @ dbcmp not and if ">> You don't have a valid target." VerTell me @ "@a/eloop/target" remove_prop 0 exit then then then me @ "@a/eloop/target" getprop ourTarget ! (* make sure psiab is ok *) me @ "@a/eloop/psiab" getpropstr dup if ourPsiab ! "@a/psiabs/$psiab" ourPsiab @ "$psiab" subst ourString ! else ">> You do not have a psiab selected." VerTell 0 exit then 1 ; : DoCheckGuard ( -- i ) (* return true if ourTarget is guarded *) #0 "@a/calls/checkguard" getprop dup if ourTarget @ "#checkguard" rot call dup if (* asys-guard decides *) ">> $target is being guarded by $guard." ourTarget @ name ourTarget @ exit? if dup ";" instr if dup ";" instr 1 - strcut pop strip then then "$target" subst swap name "$guard" subst Tell 1 else pop 0 then else pop 0 then ; : DoPresenceChecks ( -- i ) (* see if we need to made presence roll *) (* return false if concentration broken by attack or injury *) me @ "@a/eloop/attacked" getpropstr if PresenceRoll not if ">> $me's psiab fails." me @ name "$me" subst PsiabTell SetWait NukeStack 0 exit then then me @ "@a/eloop/injured" getpropstr if PresenceRoll if 1 else ">> $me's psiab fails." me @ name "$me" subst PsiabTell SetWait NukeStack 0 exit then else 1 then ; : DoFocusRoll ( -- i ) (* roll for user *) -999 ourAttackVal ! (* apply fatigue *) me @ "@a/stats/fat" over over getpropstr atoi ourDataObj @ "@a/psiabs/$psiab/fat" ourPsiab @ "$psiab" subst getpropstr atoi + intostr setprop (* get ability *) me @ "@a/psiabs/$psiab" ourPsiab @ "$psiab" subst GetModAbility me @ "@a/stats/" "psiabs/$psiab" ourPsiab @ "$psiab" subst GetBase strcat GetModAbility + ourTarget @ GetPsiResAdv - me @ "@a/eloop/genmod" getpropstr atoi + me @ "@a/psiabs/$psiab" ourPsiab @ "$psiab" subst GetModAbility if 3 else 4 then 6 0 Dice over over - ourAttackVal ! dup 4 <= if me @ RollXPs then dup 4 <= if pop pop "critsucc" exit then dup 17 >= if pop pop "critfail" exit then >= if "normsucc" else "normfail" then ; : DoDefenceRoll ( -- i ) (* roll for target *) -998 ourDefenceVal ! ourDataObj @ "@a/psiabs/$psiab/def" ourPsiab @ "$psiab" subst getpropstr dup if scratch ! else pop "normfail" exit then (* get ability *) ourTarget @ scratch @ GetModAbility ourTarget @ "@a/skills/mental discipline" GetModAbility + ourTarget @ "@a/skills/mental resistance" GetModAbility + dup if 3 else 4 then 6 0 Dice over over - ourDefenceVal ! dup 4 <= if ourTarget @ RollXPs then dup 4 <= if pop pop "critsucc" exit then dup 17 >= if pop pop "critfail" exit then >= if "normsucc" else "normfail" then ; : Doxxx ( -- ) VerifyEvent "Doxxx" Tell (* YOUR PRIMARY FUNCTION GOES HERE*) ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! Update ourArg @ if ourArg @ "#" stringpfx if "#focusxxx" ourArg @ smatch if Doxxx else "#install" ourArg @ stringpfx if DoInstall else "#uninstall" ourArg @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then exit then then ; . c q @set asys-ppp=W