Page 1 of 1

How to "But NOT" comparisation?

Posted: Wed Nov 21, 2012 8:57 am
by HSishi
Hello.

I need a bit help coding a conditioned trigger.

Given emote:

Code: Select all

The Triunity shouts, in Alaran, 'We grow tired of your worthless efforts, CURRENT_TANK. Someone more worthy should face us!'
Wanted reactions:
1. CURRENT_TANK shall get the GINA text "Drop aggro (Howl)". So I use

Code: Select all

The Triunity shouts, in Alaran, 'We grow tired of your worthless efforts, {C}. Someone more worthy should face us!'
Works fine.

2. All OTHER tanks shall get another reaction: "Get aggro from CURRENT_TANK", but JUST the other tanks.
If I use

Code: Select all

The Triunity shouts, in Alaran, 'We grow tired of your worthless efforts, {S}. Someone more worthy should face us!'
CURRENT_TANK also gets this emote.

So - how do I realize "Match trigger with {S} but not if {S}={C}"? I digged through http://www.regular-expressions.info/ but I didn't find a proper answer which works :( . Any help is appreciated, thanks.

//HSishi

Re: How to "But NOT" comparisation?

Posted: Wed Nov 21, 2012 10:18 pm
by Gimagukk
Regex isn't very efficient at detecting "not in" comparisons, but you can try this:

^The Triunity shouts, in Alaran, 'We grow tired of your worthless efforts, (?:(?!{C}).)*\. Someone more worthy should face us\!'$

You will have a problem if you have a tank whose name is a subset of another tank's (ie, Joe and Joey), and I'm not sure how performance will be with this trigger enabled.

Re: How to "But NOT" comparisation?

Posted: Thu Nov 22, 2012 7:23 am
by HSishi
Many thanks, your solution works fine :) . We don't have "subset" tank names, their names are very unique.

Just for me to understand this RegEx language - what exactly is coded in this sequence?

Code: Select all

(?:(?!{C}).)*\
(?: means "If" (?)
(?! means "not" (?)
{C} is Character name
. is for what?
*\ is placeholder for a word (used this in another trigger)

Thanks again for the help - I would never have figured that out on myself.

//HSishi

Re: How to "But NOT" comparisation?

Posted: Thu Nov 22, 2012 8:12 am
by Gimagukk
Sorry, I should have cleaned it up a little more.

^The Triunity shouts, in Alaran, 'We grow tired of your worthless efforts, (?<tankname>(?!{C}).+)\. Someone more worthy should face us\!'$

The {C} is replaced with your character name before this regex gets applied, so it is actually resolving (?!HSishi).+

(?<tankname>.....) = group capture, which will store whatever is captured in this section in a variable to be used later; your Display Text can use ${tankname} to display that tank's name on the screen.

(?!{C}) = if the next few characters aren't the character name,

.+ = match this wildcard (a period matches any character, and + says to match find that wildcard one or more times)

\. = quoting; since your trigger text contains a period, and a period is a wildcard character in regex that matches anything, this tells regex that you are literally looking for a period and not using the period as a wildcard

Re: How to "But NOT" comparisation?

Posted: Thu Nov 22, 2012 4:28 pm
by HSishi
I understand ":" in the macro replaces "<tankname>" in your explaination. Or is "{tankname}" a valid variable now, additional to "{S#}" and "{N#}"?

Thanks again for the deeper explaination into the code again :) . Maybe we should make a sticky tread with "How to code ..." solutions.

//HSishi

Re: How to "But NOT" comparisation?

Posted: Fri Nov 23, 2012 7:57 am
by Gimagukk
The ?: I had in the original was unnecessary, so I removed it. I then added in the ?(<tankname>...) as an unrelated element, so that you can capture and reuse the name of the tank. The {S} and {S#} tags are just GINA shorthand for Regex constructs -- they are translated to (?<S>...) and (?<S#>...) when used in the trigger text, and to ${S} and ${S#} when used in display / voice text.

Re: How to "But NOT" comparisation?

Posted: Fri Nov 23, 2012 3:53 pm
by HSishi
Ah, very handy. Instead of {S} we can use <anything> then to make macros more readable, but ONLY if we enable "Use Regular Expressions". Nice 8-) .

You created a nice, powerful and handy tool to give legasthenic or distracted people on raids their chance to react correctly. It's just a bit complicated to create conditional triggers ;) .

I looked for a way to support you via a donation in any form [currency, "beer", ...] but didn't find anything. Is there something?

//Hsishi

Re: How to "But NOT" comparisation?

Posted: Sun Nov 25, 2012 8:38 pm
by Gimagukk
HSishi wrote:Ah, very handy. Instead of {S} we can use <anything> then to make macros more readable, but ONLY if we enable "Use Regular Expressions". Nice 8-) .
Yes. Using the {S} and {N} tags automatically enabled RegEx, as well.
You created a nice, powerful and handy tool to give legasthenic or distracted people on raids their chance to react correctly. It's just a bit complicated to create conditional triggers ;) .
It's simple for the simple things, but since it is using RegEx at the core you can get as complex as you wish :).
I looked for a way to support you via a donation in any form [currency, "beer", ...] but didn't find anything. Is there something?
Thanks. No, there isn't a Donate option for this program, but feel free to play a drinking game in my honor every time an audio trigger goes off on your next Sepulcher 4 run!

Re: How to "But NOT" comparisation?

Posted: Mon Nov 26, 2012 10:38 am
by HSishi
No, there isn't a Donate option for this program
:| Ah well ... I so hoped there's a way to give a little tip to you.

//HSishi