eqcheck

This is a tinifugue script that checks the eq status and auto-repairs a piece if its condition is below a threshold. It's pretty rough so far, it needs improving, anyway here it is.

/set ipsafeval=9
/set hasreinforce=1

/def -w3k -mregexp -t'Wielded:[ ]*([A-Z]*.*)' weap = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess weapon %{item}%; 

/def -w3k -mregexp -t'Head:[ ]*([A-Z]*.*)' head = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess head %{item}%; 

/def -w3k -mregexp -t'Around neck:[ ]*([A-Z]*.*)' neck = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess amulet %{item}%; 

/def -w3k -mregexp -t'Upper body:[ ]*([A-Z]*.*)' breast = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess breastplate %{item}%; 

/def -w3k -mregexp -t'Heavy body:[ ]*([A-Z]*.*)' main = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess armour %{item}%; 

/def -w3k -mregexp -t'On legs:[ ]*([A-Z]*.*)' legs = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess greaves %{item}%; 

/def -w3k -mregexp -t'Light body:[ ]*([A-Z]*.*)' cloak = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess cloak %{item}%; 

/def -w3k -mregexp -t'Hands:[ ]*([A-Z]*.*)' hands = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess gloves %{item}%; 

/def -w3k -mregexp -t'Feet:[ ]*([A-Z]*.*)' feet = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess boots %{item}%; 

/def -w3k -mregexp -t'On fingers:[ ]*([A-Z]*.*)' ring = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess ring %{item}%; 

/def -w3k -mregexp -t'Shield:[ ]*([A-Z]*.*)' shield = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess shield %{item}%; 

/def -w3k -mregexp -t'Other:[ ]*([A-Z]*.*)' other = \
  /let item=$[replace("'","\\'",{P1})]%; \
  /eqprocess other %{item}%; 

/def -w3k eqprocess = \
;  /echo eq piece: %{1} %{-1}%; \
  /let eqcode=$[encode_attr({-1})]%; \
  /if ($[regmatch('(@\{[^}]+\})([^@]+)@\{n\}',eqcode)] > 0) \
;    /echo PL = %{PL} P1 = %{P1} P2 = %{P2}%; \
    /if ( {P1} =~ '@{BCwhite}') \
      /let ipst=10%; \
;      /echo %{1} ok%; \
    /endif%; \
    /if ( {P1} =~ '@{BCgreen}') \
      /let ipst=8%; \
;      /echo %{1} still ok%; \
    /endif%; \
    /if ( {P1} =~ '@{Cgreen}') \
      /let ipst=6%; \
;      /echo %{1} to be repaired%; \
    /endif%; \
    /if ( {P1} =~ '@{BCcyan}') \
      /let ipst=4%; \
;      /echo %{1} to be repaired%; \
    /endif%; \
    /if ( {P1} =~ '@{Ccyan}') \
      /let ipst=2%; \
;      /echo %{1} to be repaired%; \
    /endif%; \
;    /echo eq piece: eq_%{1}:%{ipst} - color %{P1}%; \
    /if (ipst < ipsafeval) \
      /echo "eq piece: %{1}: needs repair"%; \
      /if (hasreinforce == 1) \
        /send -w3k reinforce %{P1}%; \
      /endif%; \
    /endif%;\
  /else \
    /echo eqprocess: didn't match %{-1}%; \
  /endif%;
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License