TF - defence management script

by Unknown

Back to Mechanic's Corner.

Unknown2005-05-14 01:10:20
As I mentioned in my previous post, this is the defences script I've been working on the past few days. You'll need to make quite a few adjustments since you probably don't have the identical skills as I. It tracks and highlights defences as they go up and down. It contains a DEFENCES replacement that lists all defences you use, separating the ones that are up from the ones that are down. It supplies the commands defup, mdefup, and rdefup for putting up general defences, magical defences, and forging rune defences. It only applies the ones which are necessary, if you already have some defences up it skips those.

The code is a bit long, personally I don't think I'd want to look at it too closely without syntax highlighting. For at least a few weeks I'll have an html (colored) version of the script at http://www.bwbettin.com/files/defences.tf.html. It's also copied below so that it exists on this post even when I take the html page down.

It appears the code is too long for one post. The first portion will be here, the rest will follow in a reply.

CODE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;                          defence status                         ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;############################################################################
;;############################################################################
;;
;; KNOWN BUGS
;; ----------
;;
;; - defences_circle_down2 colors white in the main window when it fires.
;;
;;############################################################################
;;############################################################################

;;; reset defence status variables
;;; syntax: /defences_reset_status_variables
;;; note: because diminish does not show up on DEFENCES, it will very rarely appear to be set, even when I have the defence.  it will
;;;       end up getting put up every time i put up magical defences.  usually I only lose diminish when I lose other enchantments, also
;;;       diminish isn't a crucial defence that I'll be worrying about tracking so this isn't a big deal for me.
/def defences_reset_status_variables = \\
;  ;;; athletics
   /set defences_adrenaline=0 %; \\
   /set defences_breathe=0 %; \\
   /set defences_constitution=0 %; \\
   /set defences_flex=0 %; \\
   /set defences_resistance=0 %; \\
   /set defences_surge=0 %; \\
   /set defences_vitality=0 %; \\
   /set defences_weathering=0 %; \\
;  ;;; combat
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0 %; \\
;  ;;; discernment
   /set defences_deathsense=0 %; \\
   /set defences_nightsight=0 %; \\
   /set defences_thirdeye=0 %; \\
;  ;;; discipline
   /set defences_insomnia=0 %; \\
   /set defences_selfishness=0 %; \\
;  ;;; enchantments
   /set defences_beauty=0 %; \\
   /set defences_diminish=0 %; \\
   /set defences_kingdom=0 %; \\
   /set defences_levitate=0 %; \\
   /set defences_mercy=0 %; \\
   /set defences_perfection=0 %; \\
   /set defences_waterbreathe=0 %; \\
   /set defences_waterwalk=0 %; \\
;  ;;; knighthood
   /set defences_combatstyle_aggressive=0 %; \\
   /set defences_combatstyle_concentrated=0 %; \\
   /set defences_combatstyle_defensive=0 %; \\
   /set defences_combatstyle_lightning=0 %; \\
   /set defences_grip=0 %; \\
;  ;;; lowmagic
   /set defences_autumn=0 %; \\
   /set defences_blue=0 %; \\
   /set defences_circle=0 %; \\
   /set defences_orange=0 %; \\
   /set defences_red=0 %; \\
   /set defences_serpent=0 %; \\
   /set defences_yellow=0 %; \\
;  ;;; rituals
   /set defences_acquisitio=0 %; \\
   /set defences_draconis=0 %; \\
   /set defences_fortuna=0 %; \\
   /set defences_populus=0 %; \\
   /set defences_rubeus=0 %; \\
;  ;;; necromancy
   /set defences_putrefaction=0 %; \\
   /set defences_lich=0 %; \\
   /set defences_lichseed=0

/defences_reset_status_variables
/set defences_sent=sent
/set defences_received=received



;;; generate defence highlighting triggers
;;; syntax: defences_gentrig_hl('','','']])
;;; note: the current priority scheme will only allow up to 25-line triggers for defences (see tfrc.tf).
/def defences_gentrig_hl = \\
   /if (({#} > 2) & (({2} =~ "up") | ({2} =~ "down") | ({2} =~ "none"))) \\
       /let oneslash=\\\\ %; \\
       /let onepercent=%% %; \\
       /let onedollar=$$ %; \\
       /let label=%{1} %; \\
       /let priority=400 %; \\
       /shift %; \\
       /if ({1} =~ "up") \\
           /let color=Cyellow %; \\
       /elseif ({1} =~ "down") \\
           /let color=BCyellow %; \\
       /elseif ({1} =~ "none") \\
           /let color= %; \\
       /endif %; \\
       /shift %; \\
       /let line_number=1 %; \\
       /let line=%{1} %; \\
       /let generated_trig= %; \\
       /test generated_trig:=strcat('/def -mregexp -n0 -p',{priority},' -F -ax',{color},' -t"',{line},'" highlight_',{label},'_line',{line_number},' = ') %; \\
       /shift %; \\
       /while ({#}) \\
           /test ++line_number %; \\
           /test priority += 2 %; \\
           /test line:=replace({oneslash},strrep({oneslash},pow(2,{line_number}-1)),{1}) %; \\
           /if (regmatch('.*\\$$',{line}) > 0) \\
               /test line:=substr({line},0,-1) %; \\
               /test line:=strcat({line},strrep({oneslash},pow(2,{line_number}-1)-1),{onedollar}) %; \\
           /endif %; \\
           /test generated_trig:=strcat({generated_trig},'/def -mregexp -n1 -p',{priority},' -F -ax',{color},' -t"',{line},'" highlight_',{label},'_line',{line_number},' = ') %; \\
           /test generated_trig:=strcat({generated_trig},'/undef highlight_',{label},'_catch_all_but_line',{line_number},' ',strrep({onepercent},{line_number}),'; ') %; \\
           /shift %; \\
       /done %; \\
       /test generated_trig:=strcat({generated_trig},'/',{label}) %; \\
       /if ({line_number} > 1) \\
           /test generated_trig:=strcat({generated_trig},' ',strrep({onepercent},{line_number}-1),'; ') %; \\
       /endif %; \\
       /test --priority %; \\
       /while ({line_number} > 1) \\
           /test generated_trig:=strcat({generated_trig},'/def -mregexp -n1 -p',{priority},' -F -t".*" highlight_',{label},'_catch_all_but_line',{line_number},' = /undef highlight_',{label},'_line',{line_number}) %; \\
           /if ({line_number} > 2) \\
               /test generated_trig:=strcat({generated_trig},' ',strrep({onepercent},{line_number}-2),'; ') %; \\
           /endif %; \\
           /test priority -= 2 %; \\
           /test --line_number %; \\
       /done %; \\
       /eval -s0 %{generated_trig} %; \\
   /else \\
       /echol BCcyan 0 <<<< defences_gentrig_hl error: incorrect arguments provided, must be ,,]] %; \\
   /endif

;;; acquisitio
;;; up
/test defences_gentrig_hl('defences_acquisitio_up','up',\\
       '^Chanting the ritual of Acquisitio to yourself, you narrow your eyes and look $',\\
       '^around greedily for something to add to your hoard\\.$')
/def defences_acquisitio_up = /set defences_acquisitio=1 %; /set defences_received=acquisitio
;;; down
/test defences_gentrig_hl('defences_acquisitio_down','down',\\
       '^You allow the charm of Acquisitio to leave you and are no longer gripped by an $',\\
       '^unnatural need to accumulate things\\.$')
/def defences_acquisitio_down = /set defences_acquisitio=0

;;; adrenaline
;;; up
/test defences_gentrig_hl('defences_adrenaline_up','up',\\
       '^A surge of adrenaline courses through your veins\\.$')
/def defences_adrenaline_up = /set defences_adrenaline=1 %; /set defences_received=adrenaline

;;; autumn
;;; up
/test defences_gentrig_hl('defences_autumn_up','up',\\
       '^Turning to the west, you beseech the Spirits of Autumn to make your harvest $',\\
       '^plentiful\\. A sparkling wind comes forth and wraps around you, promising your $',\\
       '^harvests will be fruitful\\.$')
/def defences_autumn_up = /set defences_autumn=1 %; /set defences_received=autumn
;;; down
/test defences_gentrig_hl('defences_autumn_down','down',\\
       '^You feel the autumn wind subside\\.$')
/def defences_autumn_down = /set defences_autumn=0

;;; beauty
;;; up
/test defences_gentrig_hl('defences_beauty_up','up',\\
       '^A ray of pink light suddenly spotlights you\\.$')
/def defences_beauty_up = /set defences_beauty=1 %; /set defences_received=beauty

;;; blue
;;; up
/test defences_gentrig_hl('defences_blue_up','up',\\
       '^Pressing your hands together before you, you concentrate on your throat chakra\\.$',\\
       '^A blue glow suffuses your throat, protecting all your communications\\.$')
/def defences_blue_up = /set defences_blue=1 %; /set defences_received=blue

;;; breathe
;;; up
/test defences_gentrig_hl('defences_breathe_up','up',\\
       '^You take a few deep breaths to prepare your body for a marathon workout\\.$')
/def defences_breathe_up = /set defences_breathe=1 %; /set defences_received=breathe

;;; circle
;;; up
/test defences_gentrig_hl('defences_circle_up','up',\\
       '^Spreading your arms wide, you spin clockwise and visualize a circle of $',\\
       '^protection. A shimmering white orb springs up around you\\.$')
/def defences_circle_up = /set defences_circle=1 %; /set defences_received=circle
;;; down
/test defences_gentrig_hl('defences_circle_down','down',\\
       '^Your action causes the nearly invisible magical shield around you to fade away\\.$')
/def defences_circle_down = /set defences_circle=0
/test defences_gentrig_hl('defences_circle_down2','down',\\
       '^Your movement causes your magical shield to dissipate\\.$')
/def defences_circle_down2 = /defences_circle_down
/test defences_gentrig_hl('defences_circle_down3','down',\\
       '^\\w+ razes your magical shield with')
/def defences_circle_down3 = /defences_circle_down
/test defences_gentrig_hl('defences_circle_down4','down',\\
       '^\\w+ mutters and pokes her index finger towards you and makes a hooking $',\\
       '^gesture\\. Invisible energies slam against you, ripping apart your magical shield$',\\
       '^of protection\\.$')
/def defences_circle_down4 = /defences_circle_down

;;; combatstyles
;;; up - aggressive
/test defences_gentrig_hl('defences_combatstyle_aggressive_up','up',\\
       '^You focus your attention on the aggressive fighting style\\.$')
/def defences_combatstyle_aggressive_up = \\
   /set defences_combatstyle_concentrated=0 %; \\
   /set defences_combatstyle_defensive=0 %; \\
   /set defences_combatstyle_lightning=0 %; \\
   /set defences_combatstyle_aggressive=1 %; /set defences_received=combatstyle_aggressive
;;; up - concentrated
/test defences_gentrig_hl('defences_combatstyle_concentrated_up','up',\\
       '^You focus your attention on the concentrated fighting style\\.$')
/def defences_combatstyle_concentrated_up = \\
   /set defences_combatstyle_aggressive=0 %; \\
   /set defences_combatstyle_defensive=0 %; \\
   /set defences_combatstyle_lightning=0 %; \\
   /set defences_combatstyle_concentrated=1 %; /set defences_received=combatstyle_concentrated
;;; up - defensive
/test defences_gentrig_hl('defences_combatstyle_defensive_up','up',\\
       '^You focus your attention on the defensive fighting style\\.$')
/def defences_combatstyle_defensive_up = \\
   /set defences_combatstyle_aggressive=0 %; \\
   /set defences_combatstyle_concentrated=0 %; \\
   /set defences_combatstyle_lightning=0 %; \\
   /set defences_combatstyle_defensive=1 %; /set defences_received=combatstyle_defensive
;;; up - lightning
/test defences_gentrig_hl('defences_combatstyle_lightning_up','up',\\
       '^You focus your attention on the lightning fighting style\\.$')
/def defences_combatstyle_lightning_up = \\
   /set defences_combatstyle_aggressive=0 %; \\
   /set defences_combatstyle_concentrated=0 %; \\
   /set defences_combatstyle_defensive=0 %; \\
   /set defences_combatstyle_lightning=1 %; /set defences_received=lightning
;;; down
/test defences_gentrig_hl('defences_combatstyle_all_down','down',\\
       '^You focus your attention on using no specific fighting style\\.$')
/def defences_combatstyle_all_down = \\
   /set defences_combatstyle_aggressive=0 %; \\
   /set defences_combatstyle_concentrated=0 %; \\
   /set defences_combatstyle_defensive=0 %; \\
   /set defences_combatstyle_lightning=0

;;; constitution
;;; up
/test defences_gentrig_hl('defences_constitution_up','up',\\
       '^You clench the muscles in your stomach, determined to assert your superior $',\\
       '^constitution\\.$')
/def defences_constitution_up = /set defences_constitution=1 %; /set defences_received=constitution

;;; deathsense
;;; up
/test defences_gentrig_hl('defences_deathsense_up','up',\\
       '^You shut your eyes and concentrate on the end of life\\. A moment later, you feel$',\\
       '^inextricably linked with the strings of fate\\.$')
/def defences_deathsense_up = /set defences_deathsense=1 %; /set defences_received=deathsense
;;; down
/test defences_gentrig_hl('defences_deathsense_down','down',\\
       '^You shut your eyes and concentrate on life\\. A moment later, you feel your link $',\\
       '^with the strings of fate sever\\.$')
/def defences_deathsense_down = /set defences_deathsense=0

;;; diminish
;;; up
/test defences_gentrig_hl('defences_diminish_up','up',\\
       '^You begin to rapidly shrink in size\\.$')
/def defences_diminish_up = /set defences_diminish=1 %; /set defences_received=diminish

;;; draconis
;;; up
/test defences_gentrig_hl('defences_draconis_up','up',\\
       '^You chant the ritual of Draconis and sense a numinous layer of dragon scales $',\\
       '^surround you\\.$')
/def defences_draconis_up = /set defences_draconis=1 %; /set defences_received=draconis

;;; flex
;;; up
/test defences_gentrig_hl('defences_flex_up','up',\\
       '^You flex your muscles, which bulge and pop in a spectacular display of your $',\\
       '^outstanding physique\\.$')
/def defences_flex_up = /set defences_flex=1 %; /set defences_received=flex

;;; fortuna
;;; up
/test defences_gentrig_hl('defences_fortuna_up','up',\\
       '^The air around you blurs as you chant the ritual of Fortuna\\. You feel the winds$',\\
       '^of chance and change pass through you\\.$')
/def defences_fortuna_up = /set defences_fortuna=1 %; /set defences_received=fortuna
;;; down
/test defences_gentrig_hl('defences_fortuna_down','down',\\
       '^It is now the \\w+ of \\w+, \\d+ years after the Coming of Estarra\\.$')
/def defences_fortuna_down = /set defences_fortuna=0

;;; grip
;;; up
/test defences_gentrig_hl('defences_grip_up','up',\\
       '^You concentrate on gripping tightly with your hands\\.$')
/def defences_grip_up = /set defences_grip=1 %; /set defences_received=grip
;;; down
/test defences_gentrig_hl('defences_grip_down','down',\\
       '^You relax your grip\\.$')
/def defences_grip_down = /set defences_grip=0

;;; insomnia
;;; up
/test defences_gentrig_hl('defences_insomnia_up','up',\\
       '^You clench your fists, grit your teeth, and banish all possibility of sleep\\.$')
/def defences_insomnia_up = /set defences_insomnia=1 %; /set defences_received=insomnia

;;; kingdom
;;; up
/test defences_gentrig_hl('defences_kingdom_up','up',\\
       '^A ray of green light suddenly spotlights you\\.$')
/def defences_kingdom_up = /set defences_kingdom=1 %; /set defences_received=kingdom

;;; levitate
;;; up
/test defences_gentrig_hl('defences_levitate_up','up',\\
       '^You begin to rise on a cushion of air\\.$')
/def defences_levitate_up = /set defences_levitate=1 %; /set defences_received=levitate

;;; lich
;;; up
;;; note: The lich_up_complete trigger is type 'none' because it will conflict with the 'up' trigger for lichseed_up.
/test defences_gentrig_hl('defences_lich_up_starting','up',\\
       '^Your body begins the process of transforming into a lich\\.$')
/def defences_lich_up_starting =
/test defences_gentrig_hl('defences_lich_up_complete','none',\\
       '^The powers of Nil are yours and you drink deeply of the darkness, transforming $',\\
       '^into the powerful form of a lich\\.$')
/def defences_lich_up = /set defences_lich=1 %; /set defences_received=lich
;;; down
/test defences_gentrig_hl('defences_lich_down','down',\\
       '^You have been slain')
/def defences_lich_down = /set defences_lich=0

;;; lichseed
;;; up
/test defences_gentrig_hl('defences_lichseed_up','up',\\
       '^Prostrating yourself on the ground, you beseech the powers of Nil to grant upon$',\\
       '^you the ultimate dark gift of undeath\\. A cloud of death and darkness swirls $',\\
       '^about you, as you feel the potentialities of undeath seep into your being\\.$')
/def defences_lichseed_up = /set defences_lichseed=1 %; /set defences_received=lichseed
;;; down
/test defences_gentrig_hl('defences_lichseed_down','down',\\
       '^The powers of Nil are yours and you drink deeply of the darkness, transforming $',\\
       '^into the powerful form of a lich\\.$')
/def defences_lichseed_down = /set defences_lichseed=0

;;; mercy
;;; up
/test defences_gentrig_hl('defences_mercy_up','up',\\
       '^A ray of purple light suddenly spotlights you\\.$')
/def defences_mercy_up = /set defences_mercy=1 %; /set defences_received=mercy

;;; nightsight
;;; up
/test defences_gentrig_hl('defences_nightsight_up','up',\\
       '^Your vision sharpens with light as you gain night sight\\.$')
/def defences_nightsight_up = /set defences_nightsight=1 %; /set defences_received=nightsight

;;; orange
;;; up
/test defences_gentrig_hl('defences_orange_up','up',\\
       '^Pressing your hands together before you, you concentrate on your belly chakra\\. $',\\
       '^An orange glow suffuses the area around your stomach and the pangs of hunger $',\\
       '^disappear\\.$')
/def defences_orange_up = /set defences_orange=1 %; /set defences_received=orange
;;; down
/test defences_gentrig_hl('defences_orange_down','down',\\
       '^You feel your orange chakra fade\\.$')
/def defences_orange_down = /set defences_orange=0

;;; perfection
;;; up
/test defences_gentrig_hl('defences_perfection_up','up',\\
       '^A ray of golden light suddenly spotlights you\\.$')
/def defences_perfection_up = /set defences_perfection=1 %; /set defences_received=perfection

;;; populus
;;; up
/test defences_gentrig_hl('defences_populus_up','up',\\
       '^Confidence and exuberance fills you as you chant the joyful ritual of Populus\\.$')
/def defences_populus_up = /set defences_populus=1 %; /set defences_received=populus

;;; putrefaction
;;; up
/test defences_gentrig_hl('defences_putrefaction_up','up',\\
       '^You concentrate for a moment and your flesh begins to dissolve away, becoming $',\\
       '^slimy and wet\\.$')
/def defences_putrefaction_up = /set defences_putrefaction=1 %; /set defences_received=putrefaction
;;; down
/test defences_gentrig_hl('defences_putrefaction_down','down',\\
       '^You concentrate briefly and your flesh is once again solid\\.$')
/def defences_putrefaction_down = /set defences_putrefaction=0

;;; red
;;; up
/test defences_gentrig_hl('defences_red_up','up',\\
       '^Pressing your hands together before you, you concentrate on your root chakra\\. A$',\\
       '^red glow runs down your spine, helping anchor you to the earth\\.$')
/def defences_red_up = /set defences_red=1 %; /set defences_received=red

;;; resistance
;;; up
/test defences_gentrig_hl('defences_resistance_up','up',\\
       '^You call aloud and feel an aura of resistance shroud itself silently about you\\.$')
/def defences_resistance_up = /set defences_resistance=1 %; /set defences_received=resistance

;;; rubeus
;;; up
/test defences_gentrig_hl('defences_rubeus_up','up',\\
       '^A red haze fills your field of vision as you chant the ritual of Rubeus\\.$')
/def defences_rubeus_up = /set defences_rubeus=1 %; /set defences_received=rubeus

;;; serpent
;;; up
/test defences_gentrig_hl('defences_serpent_up','up',\\
       '^Pressing your hands together before you, you concentrate on all your chakras $',\\
       '^together\\. A serpent of rainbow energy surges up from the root of your spine and$',\\
       '^travels to the top of your head, bursting forth from your crown chakra and $',\\
       '^surrounding you with an aura of prismatic energy\\.$')
/def defences_serpent_up = /set defences_serpent=1 %; /set defences_received=serpent
;;; down
/test defences_gentrig_hl('defences_serpent_down','down',\\
       '^Your serpent\\'s aura of prismatic energy flickers and fades\\.$')
/def defences_serpent_down = /set defences_serpent=0

;;; selfishness
;;; up
/test defences_gentrig_hl('defences_selfishness_up','up',\\
       '^You rub your hands together greedily\\.$')
/def defences_selfishness_up = /set defences_selfishness=1 %; /set defences_received=selfishness
;;; down
/test defences_gentrig_hl('defences_selfishness_down','down',\\
       '^A feeling of generosity spreads throughout you\\.$')
/def defences_selfishness_down = /set defences_selfishness=0

;;; stances
;;; up - arms
/test defences_gentrig_hl('defences_stance_arms_up','up',\\
       '^You enter a stance to protect your arms\\.$')
/def defences_stance_arms_up = \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0 %; \\
   /set defences_stance_arms=1 %; /set defences_received=stance_arms
;;; up - chest
/test defences_gentrig_hl('defences_stance_chest_up','up',\\
       '^You enter a stance to protect your chest\\.$')
/def defences_stance_chest_up = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0 %; \\
   /set defences_stance_chest=1 %; /set defences_received=stance_chest
;;; up - gut
/test defences_gentrig_hl('defences_stance_gut_up','up',\\
       '^You enter a stance to protect your gut\\.$')
/def defences_stance_gut_up = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0 %; \\
   /set defences_stance_gut=1 %; /set defences_received=stance_gut
;;; up - head
/test defences_gentrig_hl('defences_stance_head_up','up',\\
       '^You enter a stance to protect your head\\.$')
/def defences_stance_head_up = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0 %; \\
   /set defences_stance_head=1 %; /set defences_received=stance_head
;;; up - left
/test defences_gentrig_hl('defences_stance_left_up','up',\\
       '^You enter a stance to protect your left side\\.$')
/def defences_stance_left_up = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0 %; \\
   /set defences_stance_left=1 %; /set defences_received=stance_left
;;; up - legs
/test defences_gentrig_hl('defences_stance_legs_up','up',\\
       '^You enter a stance to protect your legs\\.$')
/def defences_stance_legs_up = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0 %; \\
   /set defences_stance_legs=1 %; /set defences_received=stance_legs
;;; up - lower
/test defences_gentrig_hl('defences_stance_lower_up','up',\\
       '^You enter a stance to protect your lower body\\.$')
/def defences_stance_lower_up = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_right=0 %; \\
   /set defences_stance_lower=1 %; /set defences_received=stance_lower
;;; up - right
/test defences_gentrig_hl('defences_stance_right_up','up',\\
       '^You enter a stance to protect your right side\\.$')
/def defences_stance_right_up = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=1 %; /set defences_received=stance_right
;;; down
/test defences_gentrig_hl('defences_stance_all_down','down',\\
       '^You cease using a defensive stance for combat\\.$')
/def defences_stance_all_down = \\
   /set defences_stance_arms=0 %; \\
   /set defences_stance_chest=0 %; \\
   /set defences_stance_gut=0 %; \\
   /set defences_stance_head=0 %; \\
   /set defences_stance_left=0 %; \\
   /set defences_stance_legs=0 %; \\
   /set defences_stance_lower=0 %; \\
   /set defences_stance_right=0
Unknown2005-05-14 01:18:39
CODE
;;; surge
;;; up
/test defences_gentrig_hl('defences_surge_up','up',\\
       '^You pound your chest with your fists, and bellow fiercely\\. Your body expands to$',\\
       '^heroic proportions\\.$')
/def defences_surge_up = /set defences_surge=1 %; /set defences_received=surge
;;; down
/test defences_gentrig_hl('defences_surge_down','down',\\
       '^You relax the surge of power through your body, and dwindle to normal $',\\
       '^proportions\\.$')
/def defences_surge_down = /set defences_surge=0

;;; thirdeye
;;; up
/test defences_gentrig_hl('defences_thirdeye_up','up',\\
       '^You now possess the gift of the third eye\\.$')
/def defences_thirdeye_up = /set defences_thirdeye=1 %; /set defences_received=thirdeye

;;; vitality
;;; up
/test defences_gentrig_hl('defences_vitality_up','up',\\
       '^Your body positively glows with health and vitality\\.$')
/def defences_vitality_up = /set defences_vitality=1 %; /set defences_received=vitality

;;; waterbreathe
;;; up
/test defences_gentrig_hl('defences_waterbreathe_up','up',\\
       '^You briefly hold your hand over your mouth until your lips and tongue tingle\\.$')
/def defences_waterbreathe_up = /set defences_waterbreathe=1 %; /set defences_received=waterbreathe

;;; waterwalk
/test defences_gentrig_hl('defences_waterwalk_up','up',\\
       '^You pull a cosmic web down around your feet, and you sense that gravity will be$',\\
       '^your ally when entering water\\.$')
/def defences_waterwalk_up = /set defences_waterwalk=1 %; /set defences_received=waterwalk

;;; weathering
;;; up
/test defences_gentrig_hl('defences_weathering_up','up',\\
       '^A brief shiver runs through your body\\.$')
/def defences_weathering_up = /set defences_weathering=1 %; /set defences_received=weathering

;;; yellow
;;; up
/test defences_gentrig_hl('defences_yellow_up','up',\\
       '^Pressing your hands together before you, you concentrate on your solar plexus $',\\
       '^chakra\\. A golden glow suffuses your solar plexus and your body swells with $',\\
       '^power\\.$')
/def defences_yellow_up = /set defences_yellow=1 %; /set defences_received=yellow



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;                         defences command                        ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; generate defences command highlights
;;; syntax: defences_command_gentrig('','')
/def defences_command_gentrig = \\
   /if ({#} > 1) \\
       /def -mregexp -n1 -p150 -ag -t"%{2}" defences_command_highlight_%{1} = \\
           /set defences_%{1}=1 %%; \\
           /echol Cyellow 0 - %{1} %; \\
   /else \\
       /echol BCcyan 0 <<<< defences_command_gentrig error: incorrect arguments provided, must be ,. %; \\
   /endif

;;; display a label if a list of defences are all down
;;; syntax: /defences_command_isdown ( | ( ))
/def defences_command_isdown = \\
   /if ({#} > 0) \\
       /if ({#} == 1) \\
           /let defence_name=$ %;\\
           /let defence_value= %; \\
           /test defence_value:=%{defence_name} %; \\
           /if ({defence_value} == 0) \\
               /echol BCyellow 0 - %{1} %; \\
           /endif %; \\
       /else \\
           /let defence_label=%{1} %; \\
           /let defence_total= %; \\
           /shift %; \\
           /while ({#}) \\
               /let defence_name=$ %; \\
               /let defence_value= %; \\
               /test defence_value:=%{defence_name} %; \\
               /test defence_total += %{defence_value} %; \\
               /shift %; \\
           /done %; \\
           /if ({defence_total} == 0) \\
               /echol BCyellow 0 - %{defence_label} %; \\
           /endif %; \\
       /endif %; \\
   /else \\
       /echol BCcyan 0 <<<< defences_command_isdown error: incorrect arguments provided, must be or . %; \\
   /endif

;;; list defences that are currently down
;;; syntax: /defences_command_list_down
;;; note: the diminish defence has been left out of this list due to its not appearing in the DEFENCES command output.
/def defences_command_list_down = \\
   /echol BCcyan 0 Defences Down: %; \\
   /defences_command_isdown acquisitio %; \\
   /defences_command_isdown autumn %; \\
   /defences_command_isdown adrenaline %; \\
   /defences_command_isdown beauty %; \\
   /defences_command_isdown blue %; \\
   /defences_command_isdown breathe %; \\
   /defences_command_isdown circle %; \\
   /defences_command_isdown combatstyle combatstyle_aggressive combatstyle_concentrated combatstyle_defensive combatstyle_lightning %; \\
   /defences_command_isdown constitution %; \\
   /defences_command_isdown deathsense %; \\
   /defences_command_isdown draconis %; \\
   /defences_command_isdown flex %; \\
   /defences_command_isdown fortuna %; \\
   /defences_command_isdown grip %; \\
   /defences_command_isdown insomnia %; \\
   /defences_command_isdown kingdom %; \\
   /defences_command_isdown levitate %; \\
   /defences_command_isdown lich %; \\
   /defences_command_isdown lichseed %; \\
   /defences_command_isdown mercy %; \\
   /defences_command_isdown nightsight %; \\
   /defences_command_isdown orange %; \\
   /defences_command_isdown perfection %; \\
   /defences_command_isdown populus %; \\
   /defences_command_isdown putrefaction %; \\
   /defences_command_isdown red %; \\
   /defences_command_isdown resistance %; \\
   /defences_command_isdown rubeus %; \\
   /defences_command_isdown selfishness %; \\
   /defences_command_isdown serpent %; \\
   /defences_command_isdown stance stance_arms stance_chest stance_gut stance_head stance_left stance_legs stance_lower stance_right %; \\
   /defences_command_isdown surge %; \\
   /defences_command_isdown thirdeye %; \\
   /defences_command_isdown vitality %; \\
   /defences_command_isdown waterbreathe %; \\
   /defences_command_isdown waterwalk %; \\
   /defences_command_isdown weathering %; \\
   /defences_command_isdown yellow

;;; reset defence status variables and obtain new values using DEFENCES
;;; syntax: /defences_command
;;; note: the diminish defence has been left out of this list due to its not appearing in the DEFENCES command output.
/def defences_command = \\
   /defences_reset_status_variables %; \\
   /test defences_command_gentrig('acquisitio','^You are filled with the greed of Acquisitio\\\\.\\$') %; \\
   /test defences_command_gentrig('autumn','^You are followed by the autumn wind\\\\.\\$') %; \\
   /test defences_command_gentrig('adrenaline','^Your sense of time is heightened, and your reactions are speeded\\\\.\\$') %; \\
   /test defences_command_gentrig('beauty','^Your ego is regenerating by virtue of the Ray of Beauty\\\\.\\$') %; \\
   /test defences_command_gentrig('blue','^You have empowered your blue chakra\\\\.\\$') %; \\
   /test defences_command_gentrig('breathe','^Your body is prepared for a marathon workout\\\\.\\$') %; \\
   /test defences_command_gentrig('circle','^You are surrounded by a nearly invisible magical shield\\\\.\\$') %; \\
   /test defences_command_gentrig('combatstyle_aggressive','^You are fighting with powerful blows\\\\.\\$') %; \\
   /test defences_command_gentrig('combatstyle_concentrated','^You are fighting with focused strikes\\\\.\\$') %; \\
   /test defences_command_gentrig('combatstyle_defensive','^You are fighting defensively\\\\.\\$') %; \\
   /test defences_command_gentrig('combatstyle_lightning','^You are fighting with headstrong speed\\\\.\\$') %; \\
   /test defences_command_gentrig('constitution','^You are using your superior constitution to prevent nausea\\\\.\\$') %; \\
   /test defences_command_gentrig('deathsense','^Your mind is sensing the death of others\\\\.\\$') %; \\
   /test defences_command_gentrig('draconis','^You are surrounded by numinous dragon scales\\\\.\\$') %; \\
   /test defences_command_gentrig('flex','^Your muscles are flexed for increased strength\\\\.\\$') %; \\
   /test defences_command_gentrig('fortuna','^You are reaping the gifts of Fortuna\\\\.\\$') %; \\
   /test defences_command_gentrig('grip','^Your hands are gripping your wielded items tightly\\\\.\\$') %; \\
   /test defences_command_gentrig('insomnia','^You have insomnia, and cannot easily go to sleep\\\\.\\$') %; \\
   /test defences_command_gentrig('kingdom','^Your blood is clotting by virtue of the Ray of the Kingdom\\\\.\\$') %; \\
   /test defences_command_gentrig('levitate','^You are walking on a small cushion of air\\\\.\\$') %; \\
   /test defences_command_gentrig('lich','^You are a lich\\\\.\\$') %; \\
   /test defences_command_gentrig('lichseed','^Your body is prepared for lichdom when death comes for you\\\\.\\$') %; \\
   /test defences_command_gentrig('mercy','^Your health is regenerating by virtue of the Ray of the Merciful Hand\\\\.\\$') %; \\
   /test defences_command_gentrig('nightsight','^Your vision is heightened to see in the dark\\\\.\\$') %; \\
   /test defences_command_gentrig('orange','^You have empowered your orange chakra\\\\.\\$') %; \\
   /test defences_command_gentrig('perfection','^Your mana is regenerating by virtue of the Ray of Perfection\\\\.\\$') %; \\
   /test defences_command_gentrig('populus','^You are filled with exuberance\\\\.\\$') %; \\
   /test defences_command_gentrig('putrefaction','^You are bathed in the glorious protection of decaying flesh\\\\.\\$') %; \\
   /test defences_command_gentrig('red','^The pull of the earth roots you more firmly to the ground\\\\.\\$') %; \\
   /test defences_command_gentrig('resistance','^You are resisting magical damage\\\\.\\$') %; \\
   /test defences_command_gentrig('rubeus','^You are filled with the wrath of Rubeus\\\\.\\$') %; \\
   /test defences_command_gentrig('selfishness','^You are feeling quite selfish\\\\.\\$') %; \\
   /test defences_command_gentrig('serpent','^You are standing within a prismatic barrier\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_arms','^Your fighting stance is defending your arms\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_chest','^Your fighting stance is defending your chest\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_gut','^Your fighting stance is defending your gut\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_head','^Your fighting stance is defending your head\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_left','^Your fighting stance is defending your left side\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_legs','^Your fighting stance is defending your legs\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_lower','^Your fighting stance is defending your lower body\\\\.\\$') %; \\
   /test defences_command_gentrig('stance_right','^Your fighting stance is defending your right side\\\\.\\$') %; \\
   /test defences_command_gentrig('surge','^Your essence is surging into your body\\\\.\\$') %; \\
   /test defences_command_gentrig('thirdeye','^You are viewing the world through the third eye\\\\.\\$') %; \\
   /test defences_command_gentrig('vitality','^You will call upon your fortitude in need\\\\.\\$') %; \\
   /test defences_command_gentrig('waterbreathe','^You are filtering air from water for breathing\\\\.\\$') %; \\
   /test defences_command_gentrig('waterwalk','^You can walk upon water\\\\.\\$') %; \\
   /test defences_command_gentrig('weathering','^Your body is weathering the storm of life a little better\\\\.\\$') %; \\
   /test defences_command_gentrig('yellow','^You have empowered your yellow chakra\\\\.\\$') %; \\
   /def -mregexp -n1 -p150 -F -aBCcyan -t"^You are protected by \\\\d+ defences\\\\.\\$" defences_command_end = \\
       /purge defences_command_highlight_* %%; \\
       /defences_command_list_down %; \\
   defences %; \\
   /echol BCcyan 0 Defences Up: %; \\

;;; DEFENCES command replacement
;;; syntax: def
/alias def /defences_command



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;                      put up general defences                    ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; put up the first defence in the list which isn't already up
;;; syntax: /defences_general_send_def
/def defences_general_send_def = \\
   /if ({defences_acquisitio} == 0) \\
       /set defences_sent=acquisitio %; \\
       chant acquisitio on %; \\
   /elseif ({defences_adrenaline} == 0) \\
       /set defences_sent=adrenaline %; \\
       adrenaline %; \\
   /elseif ({defences_blue} == 0) \\
       /set defences_sent=blue %; \\
       invoke blue %; \\
   /elseif ({defences_breathe} == 0) \\
       /set defences_sent=breathe %; \\
       breathe deep %; \\
   /elseif (({defences_combatstyle_aggressive} == 0) & ({defences_combatstyle_concentrated} == 0) & ({defences_combatstyle_defensive} == 0) & ({defences_combatstyle_lightning} == 0)) \\
       /set defences_sent=combatstyle_aggressive %; \\
       combatstyle aggressive %; \\
   /elseif ({defences_constitution} == 0) \\
       /set defences_sent=constitution %; \\
       constitution %; \\
   /elseif ({defences_deathsense} == 0) \\
       /set defences_sent=deathsense %; \\
       deathsense on %; \\
   /elseif ({defences_draconis} == 0) \\
       /set defences_sent=draconis %; \\
       chant draconis %; \\
   /elseif ({defences_flex} == 0) \\
       /set defences_sent=flex %; \\
       flex %; \\
   /elseif ({defences_fortuna} == 0) \\
       /set defences_sent=fortuna %; \\
       chant fortuna %; \\
   /elseif ({defences_grip} == 0) \\
       /set defences_sent=grip %; \\
       grip %; \\
   /elseif ({defences_insomnia} == 0) \\
       /set defences_sent=insomnia %; \\
       insomnia %; \\
   /elseif ({defences_nightsight} == 0) \\
       /set defences_sent=nightsight %; \\
       nightsight %; \\
   /elseif ({defences_populus} == 0) \\
       /set defences_sent=populus %; \\
       chant populus %; \\
   /elseif ({defences_red} == 0) \\
       /set defences_sent=red %; \\
       invoke red %; \\
   /elseif ({defences_resistance} == 0) \\
       /set defences_sent=resistance %; \\
       resistance %; \\
   /elseif ({defences_rubeus} == 0) \\
       /set defences_sent=rubeus %; \\
       chant rubeus %; \\
   /elseif ({defences_selfishness} == 0) \\
       /set defences_sent=selfishness %; \\
       selfishness %; \\
   /elseif (({defences_stance_arms} == 0) & ({defences_stance_chest} == 0) & ({defences_stance_gut} == 0) & ({defences_stance_head} == 0) & ({defences_stance_left} == 0) & ({defences_stance_legs} == 0) & ({defences_stance_lower} == 0) & ({defences_stance_right} == 0)) \\
       /set defences_sent=stance_lower %; \\
       stance lower %; \\
   /elseif ({defences_thirdeye} == 0) \\
       /set defences_sent=thirdeye %; \\
       thirdeye %; \\
   /elseif ({defences_weathering} == 0) \\
       /set defences_sent=weathering %; \\
       weathering %; \\
   /else \\
       /echol BCcyan 0 <<<< general defences are all up >>>> %; \\
       /undef prompt_catch_defences_general %; \\
       /set defences_sent=sent %; \\
       /set defences_received=received %; \\
   /endif

;;; put up any general defences that are not already up
;;; syntax: /defences_general_put_up
/def defences_general_put_up = \\
   /def -mregexp -n0 -p950 -F -q -h"PROMPT (\\\\d+)h, (\\\\d+)m, (\\\\d+)e, (\\\\d+)p, (\\\\d+)en, (\\\\d+)w (.*)\\\\-" prompt_catch_defences_general = \\
       /if ({defences_sent} =~ {defences_received}) \\
           /if (({status_balance} == 1) & ({status_balance_leftarm} == 1) & ({status_balance_rightarm} == 1) & ({status_equilibrium} == 1)) \\
               /defences_general_send_def %%; \\
           /endif %%; \\
       /endif %; \\
   /defences_general_send_def

;;; refresh the defence status variables and put up any general defences that are not already up
;;; syntax: defup
/alias defup \\
   /defences_command %; \\
   /def -mregexp -n1 -p150 -F -t"^You are protected by \\\\d+ defences\\\\.\\$" defences_general_initiate_put_up = \\
       /repeat -1 1 /defences_general_put_up



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;                      put up magical defences                    ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/set defences_magical_previous_wand=



;;; get wand from storage and rub it
;;; syntax: /defences_magical_get_wand_and_rub
/def defences_magical_get_wand_and_rub = \\
   /if ({#} > 0) \\
       /set defences_magical_previous_wand=%{1} %; \\
       get %{1} from %{equipment_packfesix} %; \\
       wield %{1} %; \\
       rub %{1} %; \\
   /else \\
       /echol BCcyan 0 <<<< defences_magical_get_wand_and_rub error: you must supply the number of a wand. >>>> %; \\
   /endif

;;; put a wand back into storage
;;; syntax: /defences_magical_put_wand_away
/def defences_magical_put_wand_away = \\
   /if ({#} > 0) \\
       unwield %{1} %; \\
       put %{1} into %{equipment_packfesix} %; \\
   /else \\
       /echol BCcyan 0 <<<< defences_magical_put_wand_away error: you must supply the number of a wand. >>>> %; \\
   /endif

;;; put up the first defence in the list which isn't already up
;;; syntax: /defences_magical_send_def
/def defences_magical_send_def = \\
   /if ({defences_beauty} == 0) \\
       /set defences_sent=beauty %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_beauty} %; \\
   /elseif ({defences_diminish} == 0) \\
       /set defences_sent=diminish %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_diminish} %; \\
   /elseif ({defences_kingdom} == 0) \\
       /set defences_sent=kingdom %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_kingdom} %; \\
   /elseif ({defences_levitate} == 0) \\
       /set defences_sent=levitate %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_levitate} %; \\
   /elseif ({defences_mercy} == 0) \\
       /set defences_sent=mercy %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_mercy} %; \\
   /elseif ({defences_perfection} == 0) \\
       /set defences_sent=perfection %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_perfection} %; \\
   /elseif ({defences_waterbreathe} == 0) \\
       /set defences_sent=waterbreathe %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_waterbreathe} %; \\
   /elseif ({defences_waterwalk} == 0) \\
       /set defences_sent=waterwalk %; \\
       /if ({defences_magical_previous_wand} !~ "") /defences_magical_put_wand_away %{defences_magical_previous_wand} %; /endif %; \\
       /defences_magical_get_wand_and_rub %{equipment_wand_waterwalk} %; \\
   /else \\
       /echol BCcyan 0 <<<< magical defences are all up >>>> %; \\
       /undef prompt_catch_defences_magical %; \\
       /set defences_sent=sent %; \\
       /set defences_received=received %; \\
       /defences_magical_put_wand_away %{defences_magical_previous_wand} %; \\
       /set defences_magical_previous_wand= %; \\
       get %{equipment_sword1} from %{equipment_packfesix} %; \\
       get %{equipment_sword2} from %{equipment_packfesix} %; \\
       wield %{equipment_sword1} %; \\
       wield %{equipment_sword2} %; \\
       grip %; \\
   /endif

;;; put up any magical defences that are not already up
;;; syntax: /defences_magical_put_up
/def defences_magical_put_up = \\
   /def -mregexp -n0 -p950 -F -q -h"PROMPT (\\\\d+)h, (\\\\d+)m, (\\\\d+)e, (\\\\d+)p, (\\\\d+)en, (\\\\d+)w (.*)\\\\-" prompt_catch_defences_magical = \\
       /if ({defences_sent} =~ {defences_received}) \\
           /if (({status_balance} == 1) & ({status_balance_leftarm} == 1) & ({status_balance_rightarm} == 1) & ({status_equilibrium} == 1)) \\
               /defences_magical_send_def %%; \\
           /endif %%; \\
       /endif %; \\
   unwield %{equipment_sword1} %; \\
   unwield %{equipment_sword2} %; \\
   put %{equipment_sword1} into %{equipment_packfesix} %; \\
   put %{equipment_sword2} into %{equipment_packfesix} %; \\
   /set defences_magical_previous_wand= %; \\
   /defences_magical_send_def

;;; refresh the defence status variables and put up any magical defences that are not already up
;;; syntax: mdefup
/alias mdefup \\
   /defences_command %; \\
   /def -mregexp -n1 -p150 -F -t"^You are protected by \\\\d+ defences\\\\.\\$" defences_magical_initiate_put_up = \\
       /repeat -1 1 /defences_magical_put_up



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;                   put up forging rune defences                  ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; put up the first defence in the list which isn't already up
;;; syntax: /defences_rune_send_def
/def defences_rune_send_def = \\
   /if ({defences_sent} == 0) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch rimyur on %{equipment_sword1} %; \\
   /elseif ({defences_sent} == 1) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch rimyur on %{equipment_sword2} %; \\
   /elseif ({defences_sent} == 2) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch gukyur on %{equipment_sword1} %; \\
   /elseif ({defences_sent} == 3) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch gukyur on %{equipment_sword2} %; \\
   /elseif ({defences_sent} == 4) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch duryur on %{equipment_sword1} %; \\
   /elseif ({defences_sent} == 5) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch duryur on %{equipment_sword2} %; \\
   /elseif ({defences_sent} == 6) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch genyur on %{equipment_fullplate} %; \\
   /elseif ({defences_sent} == 7) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch girnyur on %{equipment_fullplate} %; \\
   /elseif ({defences_sent} == 8) \\
       /test ++defences_sent %; \\
       outr coal %; \\
       etch eftyur on %{equipment_fullplate} %; \\
   /else \\
       /echol BCcyan 0 <<<< rune defences are all up >>>> %; \\
       /undef prompt_catch_defences_rune %; \\
       /undef defences_rune_etched_catch %; \\
       /undef defences_rune_already_etched_catch %; \\
       /set defences_sent=sent %; \\
       /set defences_received=received %; \\
       inr 9 coal %; \\
   /endif

;;; put up any rune defences that are not already up
;;; syntax: /defences_rune_put_up
/def defences_rune_put_up = \\
   /def -mregexp -n0 -p950 -F -q -h"PROMPT (\\\\d+)h, (\\\\d+)m, (\\\\d+)e, (\\\\d+)p, (\\\\d+)en, (\\\\d+)w (.*)\\\\-" prompt_catch_defences_rune = \\
       /if ({defences_sent} =~ {defences_received}) \\
           /if (({status_balance} == 1) & ({status_balance_leftarm} == 1) & ({status_balance_rightarm} == 1) & ({status_equilibrium} == 1)) \\
               /defences_rune_send_def %%; \\
           /endif %%; \\
       /endif %; \\
   /def -mregexp -n0 -p150 -F -t"^You take a piece of coal and begin etching a" defences_rune_etched_catch = /test ++defences_received %; \\
   /def -mregexp -n0 -p150 -F -t"^There is no need to duplicate runes\\\\.\\$" defences_rune_already_etched_catch = /test ++defences_received %; \\
   /set defences_sent=0 %; \\
   /set defences_received=0 %; \\
   /defences_rune_send_def

;;; apply forging runes to both swords and fullplate
;;; syntax: rdefup
/alias rdefup /defences_rune_put_up
Unknown2005-05-14 12:39:45
Well you breached a 1000 lines of code on this one. The html version is soooo much easier on the eyes. Anyway, nice job Druth.