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 ➜ making triggers

making triggers

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


Posted by ChrisG   Canada  (1 post)  Bio
Date Thu 23 Aug 2001 11:29 PM (UTC)
Message
Hi this is such a newbie question but i'm going to ask it anyways since i don't know who else to ask. How do i make a tigger that will automatically make my character quaff a potion if he's been hit for 30 or more hp.

So it would work like this

Monsters hit mauls you [46] (where 46 is the number of hitpoints)

Now i want to make it so that if the HP hit taken is greater than 40 then the command to be issued would be to quaff potion.

Is this possible? am i crack talking?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 24 Aug 2001 01:29 AM (UTC)

Amended on Fri 24 Aug 2001 01:31 AM (UTC) by Nick Gammon

Message
Yes, you can make a fancy regular expression that matches on 30 or more, something like this:


Match on: ^.* hit mauls you ([3-9][0-9]|[0-9]{3,})
Send: quaff potion
Enabled: checked
Regular expression: checked


This will match on 30 onwards. What it does is look for a digit in the range 3 to 9, followed by one in the range 0 to 9 (ie. 30 to 99), *or* any 3 digit number.

I have assumed that you don't know the monster's name, so the first ".*" represents some monster name.

I also assumed that the brackets in your question did not actually appear in the output. If they do you will need to put them in with a backslash in front of them, like this:


Match on: ^.* hit mauls you \[([3-9][0-9]|[0-9]{3,})\]


Your question mentioned you want to check > 30, and then later you said > 40. My answer is correct for > 30, if you want > 40, then change the first "3" in the regular expression to a "4".

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


9,798 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.