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 ➜ Help with trigger

Help with trigger

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


Posted by Talonthalas   (1 post)  Bio
Date Thu 28 Mar 2002 05:16 PM (UTC)
Message
Ok, I want a trigger that will automatically drink a health elixer when my health level gets below a certain number.

The health/mana display looks like this:

2380h, 2380m ex-

It is normally green, with the ex- being kind of a whitish-gray color.

When your health starts to go down: 2380h-1950h-1523h... The color changes on only the health indicator to yellow. I want a trigger that will automatically "drink health" when it gets below a certain number, or when it turns yellow... it turns yellow about 1750h.

I really don't understand how to work the triggers so I'm asking here. Any help would be appreciated.

Thanks,
Talon
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 29 Mar 2002 09:53 PM (UTC)
Message
Probably the simplest is to make a trigger that matches on the general format of the line, calls a script and the script checks the actual health amount. Something like matching on ...


*h, *m, ex-*


Then the first wildcard will be the health amount. The script that trigger would call would be something like this ...


sub OnHealth (strName, strLine, aryWildcards) 
dim health

  health = cint (aryWildcards (1))
  if health < 1500 then
     world.send "drink health"
  end if
end sub

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


8,501 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.