Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ want to modify this script slighly

want to modify this script slighly

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by BraG   (1 post)  Bio
Date Sat 07 May 2005 06:59 PM (UTC)
Message
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>

Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Sat 07 May 2005 08:29 PM (UTC)

Amended on Sat 07 May 2005 08:32 PM (UTC) by Flannel

Message
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.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,619 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.