want to modify this script slighly

Posted by BraG on Sat 07 May 2005 06:59 PM — 2 posts, 13,182 views.

#0
Nick wrote me this heal script a long time ago and I've had a lot of success with it but I would like to make a slight modification...

Basically when I type "group" I see something to this effect"

"Your group consists of:
( Head) 846/740 hit, 192/192 move Jim
(Front) 579/579 hit, 154/154 move Joe
(Front) 539/550 hit, 160/160 move Bob
(Front) 562/562 hit, 160/160 move Jay
(Front) 323/323 hit, 109/109 move Yens"

The script then automatically calculates which person is missing the most hit points and I just type an alias to heal that person... The problem is if there is a "pet" in the group it kind of changes the output,

"(Front) 323/323 hit, 109/109 move a beautiful pegasus"

Basically if that case happens I just want to ignore the pet, which are generally in the form "a horse", "a water elemental", "a whatever"...

Here's the script...


<triggers>

  <trigger
   enabled="y"
   match="Your group consists of:"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable &quot;person&quot;, &quot;&quot;
SetVariable &quot;hp&quot;, 999999999</send>
  </trigger>

  <trigger
   custom_colour="2"
   enabled="y"
   match="^\(.*\)\s+(\d+)/\d+\s+hit,\s+\d+/\d+\s+move\s+(.*)$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if %1 &lt; CLng (GetVariable (&quot;hp&quot;)) then
  SetVariable &quot;hp&quot;, %1
  SetVariable &quot;person&quot;, &quot;%2&quot;
end if
</send>
  </trigger>

</triggers>

<aliases>
  <alias
   match="--heal"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>if GetVariable (&quot;person&quot;) &lt;&gt; &quot;&quot; _
  and GetVariable (&quot;hp&quot;) &lt;&gt; 999999999 then
 Send &quot;cast 'full heal' &quot; &amp; GetVariable (&quot;person&quot;)
end if</send>
  </alias>
</aliases>


and


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="^\(.*\)\s+(\d+)/(\d+)\s+hit,\s+\d+/\d+\s+move\s+(.*)$"
   regexp="y"
   send_to="12"
   sequence="100"
   other_text_colour="black"
   other_back_colour="black"
  >
  <send>if %2 &gt; 0 then  ' don't divide by zero!
  if (100 * %1 / %2) &lt; CLng (GetVariable (&quot;hp&quot;)) then
    SetVariable &quot;hp&quot;, 100 * %1 / %2  ' save percentage
    SetVariable &quot;person&quot;, &quot;%3&quot;
  end if
end if
</send>
  </trigger>
</triggers>

USA #1
Change the trigger to this:
^\(.*\)\s+(\d+)/(\d+)\s+hit,\s+\d+/\d+\s+move\s+(?!a .*)(.*)$
What that does is match on anything EXCEPT where the last bit is 'a (anything)'. Assuming, of course, that only pets have that format.

Edit:
Why do you have that trigger twice? It does different things too. Thats... odd.
How does the two trigger thing work exactly?
Anyway, that's not important. I guess you need to change them both then.