using pattern matching in triggers

Locked
Huggly
Posts: 51
Joined: Mon Mar 19, 2012 7:10 pm

using pattern matching in triggers

Post by Huggly » Mon Mar 19, 2012 7:15 pm

So, I took a look at this program. Can't figure out how to implement a trigger that will match for multiple people.

Just as an example, if someone misses jumping in Resplendent temple, the emote is "xzy failed to make the sacrifice"

How would I create a trigger that will work for any name replacing xyz.

You can do this in GTT using {s} in the emote, and in the audio and text display portions.
Last edited by Huggly on Tue Mar 20, 2012 8:26 am, edited 1 time in total.

Gimagukk
Site Admin
Posts: 237
Joined: Wed Oct 26, 2011 9:29 pm

Re: using pattern matching in triggers

Post by Gimagukk » Tue Mar 20, 2012 7:37 am

For compatibility and ease of use, I have added support for the {S} token. You will need to get the latest update (from the blue menu bar in the app, select "Check for Updates").
------------------------------------

You can also match it using regular expressions. Using your example, let's say there are multiple things that the player could fail to do, such as "xyz failed to make the sacrifice" or "xyz failed to run away":
Search Text: (?<name>.+) failed to (?<action>.+)
Use Regular Expressions checkbox: Checked
Display Text: Failure: ${name} did not ${action}

The search text is basically equivalent of multiple {S} tags to match pieces of the trigger. The (?<xxxx>yyyy) notation just says "this part of the trigger is a section that should match "yyyy" which I would like to refer to as variable ${xxxx} later". The "yyyy" in this case is ".+", which is just a wildcard that matches any string fo characters. (Thinking about this now, I will probably add support for tags like {S1}, {S2}, etc. tonight to make this type of trigger easier to set up.)

------------------------------------

While regular expressions are admittedly more complicated to set up, they allow for more complicated trigger matches. For example, if I wanted a trigger that would fire whenever I critically nuke a mob for 80k+ damage (but not 79k or lower), I can use the following:
Search Text: You deliver a critical blast! \((?<dmg>(\d{6})|([8-9]\d{4}))\)
Display Text: You crit for ${dmg}!

That search text is basically saying if you see the "You deliver a critical blast" line followed by a number that is either (a) 5 digits long and starts with and 8 or a 9, or (b) 6 digits long, consider it a match and store the matched number in a variable called ${dmg}.

------------------------------------

Another example is VoA where I want a trigger to alert me when my name is in a list of characters that are called out. The trigger text is "Voice of Ryken shouts 'John, Jack, and Fred: Find new targets for your actions!'" I want to be alerted if my name (Fred) is called, but not if my buddy Freddie is called.
Search Text: Voice of Ryken shouts(.+('|\s){C}(,|:).+|)Find new targets for your actions!'
Display Text: {C} Change Targets!

This will match if it finds my character's name (using GINA's {C} tag) in the list of players called.

Huggly
Posts: 51
Joined: Mon Mar 19, 2012 7:10 pm

Re: using pattern matching in triggers

Post by Huggly » Tue Mar 20, 2012 4:44 pm

Thanks for adding the {s} it will allow triggers imported from GTT to work without modification.

I was getting hung up on the regex portion of the search text. I misunderstood that it had to be wrapped in curly brackets. The webpage doesn't explain it quite as well as your post did.

Gimagukk
Site Admin
Posts: 237
Joined: Wed Oct 26, 2011 9:29 pm

Re: using pattern matching in triggers

Post by Gimagukk » Tue Mar 20, 2012 6:38 pm

Thanks for the feedback. I'll work on adding a section to the web site to explain the regex feature in more detail, as well as adding more regex samples to the Examples package in the Library.

brogett
Posts: 1
Joined: Thu Apr 05, 2012 4:26 pm

Re: using pattern matching in triggers

Post by brogett » Thu Apr 05, 2012 4:31 pm

With the new language requirements in VoA, I'm wondering if it could be possible to implement a simple approximate matching algorithm. This is hard for regular expressions (although not impossible, but it's a royal PITA), but for sub-string matching it maybe easier. Eg slide a window along looking for more than X% of characters being identical.

This means T4 emotes with people on say language 70 or 80 may still be sufficiently accurate to trigger. I'll have to think about whether a combination of nasty a|b|c combinations allows for the same thing via regexps though.

Thanks.

Gimagukk
Site Admin
Posts: 237
Joined: Wed Oct 26, 2011 9:29 pm

Re: using pattern matching in triggers

Post by Gimagukk » Fri Apr 06, 2012 9:01 pm

I won't be implementing a deliberate "language buster" feature. However, you may be able to get a decent match on some triggers by using regular expressions to focus more on where the spaces in sentences are. For example, take the sentence:

The quick brown fox jumped over the lazy dog.

The following regular expression would register as a match:
.{3} .{5} .{5} .{3} .{6} .{4} .{3} .{4} .{4}

This means "look for any 3 characters, followed by a space, followed by any 5 characters, followed by a space, follow by any 5 characters, followed by a space" etc. Of course, this pattern would also match "The sleek black cat jumped over the slow dog." Also, I can't remember if the language scrambling is applied to character names, so you may or may not be able to use the {C} tag.

Locked