General scripting design question

Posted by Septe on Thu 06 Feb 2014 07:09 PM — 4 posts, 19,015 views.

USA #0
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.
Australia Forum Administrator #1
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.
Australia Forum Administrator #2
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.
Amended on Thu 06 Feb 2014 07:55 PM by Nick Gammon
USA #3
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.