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.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Trigger help, text matching and variable setting

Trigger help, text matching and variable setting

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


Posted by TheExile   (12 posts)  Bio
Date Thu 15 Sep 2011 02:49 PM (UTC)

Amended on Thu 15 Sep 2011 02:50 PM (UTC) by TheExile

Message
I thought I would make a simple trigger to capture a mobs name as they attacked me, set it as a variable and use an alias to "kill target" to make killing same named mobs a bit faster.

Well it didn't turn out to be so simple, the problem I run into is matching the text because mobs names can be one word or five and their attack (which can be almost as varied) comes before the you, an example.

Quote:
Large Metallic Drone thrashes you in the ribs


This mob uses thrashes as his attack but there are mobs that shoots/slashes/bludgeons/etc. also with this mobs as with all of them there is usually a couple shortcuts you can use to kill it, in this mobs case, "kill drone/large/metallic" all work.

I'm just unsure of what to do here, if someone can help me out with capturing the mob's name and setting it to a variable, if I have to I can insert all the possible attacks into the trigger (shoots|slashes|bludgeons|etc).

Thanks for any and all assistance.
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 15 Sep 2011 09:30 PM (UTC)
Message
The general technique would be to match something like this (using regular expressions):



^(.*) (shoots|slashes|bludgeons|etc) you 


Now %1 is the mob name.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by TheExile   (12 posts)  Bio
Date Reply #2 on Fri 16 Sep 2011 03:12 AM (UTC)
Message
Ah yes, thank you, with that I finally got it working. I didn't think (.*) matched multiple words that was on me for not trying that.

Thanks for the help.
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.


11,840 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.