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 ➜ General scripting design question

General scripting design question

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


Posted by Septe   USA  (9 posts)  Bio
Date Thu 06 Feb 2014 07:09 PM (UTC)
Message
Ok, I'm looking at creating an auto-rescue system for my groupies. I've successfully created a trigger for the following:

A gnome hits Octe for 28 damage.

The trigger turns out to be:

^(.*?) Octe for (.*?) damage\.$

This leads to a problem. It's awfully easy to trigger the autorescue. I've counted 34 damage verbs which I could create each one. Mobs come in three ways, "a mob", "an angry mob", or "mob name". The combinations become enormous. Another way to handle this would be to set an "in combat" variable and only to have the above trigger active then. It doesn't help when mobs aggy my groupies. Also, Octe isn't always going to be my groupie. I could have other groupies.

I've looked at keeping the trigger simple as above, creating multiple damage verbs triggers, putting triggers in folders that are enabled/disabled. Each one, has it's inherent problems. Is there something else that I may have not looked at?

Thanks.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 06 Feb 2014 07:50 PM (UTC)
Message
You can have optional words in regexps, eg.


 ^(A )?(angry )?(.*?) Octe for (.*?) damage\.$ 


You can also have choices, eg.


(hits|pounds|slices|dices|cuts)



Template:regexp Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 06 Feb 2014 07:54 PM (UTC)

Amended on Thu 06 Feb 2014 07:55 PM (UTC) by Nick Gammon

Message
Your groupies could also be a variable, which can have choices, eg.


 ^(A )?(angry )?(.*?) (@!groupname) for (\d+) damage\.$ 


Check "expand variables". Now the variable "groupname" can consist of choices, eg.


Tom|Dick|Harry


Make a simple system (a couple of aliases) to set up such variable when you form a group.

eg.


groupis Tom Dick Harry


The alias would put those together, with "|" between them, and put the result into the "groupname" variable.

- Nick Gammon

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

Posted by Septe   USA  (9 posts)  Bio
Date Reply #3 on Thu 06 Feb 2014 08:18 PM (UTC)
Message
Thanks! I'll try these. Some of the bigger damage verbs come with === or --- on both sides of the verbs though not on all of them. Obviously, I haven't seen all of the verbs so I can't verify what's on this upper levels of damage and help damage verbs doesn't show those extra characters.

I was just worried about people setting off the triggers the way I had it.
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.


14,131 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.