PDA

View Full Version : Sound set chat triggers and exclusion.



Zhakathoom
July 30th, 2025, 12:18
Hello.

This might be a dumb thing, but it strikes me as odd - in my current knowledge of the system and the use of it - that there is no option to "inverse" or "exclude" chat triggers for sound sets.

I have made a custom soundset that plays "YAY!" through VLC on a crit by detecting "[Critical success]" from the chat. And it works like a charm. However I have had NPC's both fumble and crit tower-rolls, and having the sound trigger also trigger then is mostly unwanted, although I must admit it have spurred a few laughs..

I can easily adjust it so that the trigger goes off only while a [Critical success] is registered along with [TOWER], but I can't make it so that it triggers ONLY if [Critical success] and NOT [TOWER] is detected.

Having the simple option of "inverse" or "exclude" would be sweet (for me at least). Then I could effectively make a "if Crit and NOT Tower, then.." trigger.

I tried looking into the Lua stuff but that's way too complicated for me to figure out.

Has anyone else had the same issue as me and found a solution/workaround?

Zacchaeus
July 30th, 2025, 14:13
You might be able to do what you want if you use a REGEX expression in. Details of the lua version of REGEX here https://www.lua.org/pil/20.2.html

Zhakathoom
July 31st, 2025, 09:16
You might be able to do what you want if you use a REGEX expression in. Details of the lua version of REGEX here https://www.lua.org/pil/20.2.html

Well, thanks for your answer, but I have tried Regex/Lua but I can't get it to work: There isn't really an obvious magic character that "Exclude" a value. There is the ^ symbol that can be used like this "[^abc]" to match anything other than "abc", but that does nothing helpful as far as I can tell as it's not an exclusive match..

It's not apparent to me how the syntax would be used in FG. I assume it's not the full Lua code with bells and whistles and if's and elses, but I've tried a lot of various uses from various resources with no luck. Including lookaheads and lookbehinds and the lot.

I would think (?<!TOWER)%[Critical Success%], which is a negative lookbehind should work, but I must be missing something because it does nothing. Neither does ^((?!TOWER).)*$ which is a negative lookahead. Then there's the infinite testing possibilities of matching variations of these expressions, like ^((?!%[TOWER%]).%[Critical Success%])*$ with all the different triggers to see if anything fires.. It's guesswork..

The examples given on the atlassian FG pages aren't really giving me much help either; they just use the magic character escape % to make the regex match treat the brackets as brackets and not a magic character. Going off of those examples I would still need something to "invert/exclude" the [TOWER] match.

Example (if "!" was a "not" function like with C#):

%[Critical Success%]
!%[TOWER%]

I assume each trigger ticks a flag in FG that when all pass plays the associated sound, so implementing logic for "inverting" a trigger could possibly be handled within FG? A small tick-box would be a lot more userfriendly than this Regex stuff.. I've spent the better part of a day trying to make sense of it and it's still a shot in the dark each time I try something.

Any help either with an appropriate Regex match pattern example or another solution would be much appreciated.


//UPDATE:/

I went on over to regexr.com and copied the chat outputs from a crit in the tower and a crit out of tower in as test strings. After some fiddling I found that the reason why the expressions containing the TOWER exclusion AND the critical success inclusion didn't work is because of the newline arguements within the string as it's presented on several lines. Making it one line worked with this Regex match:

^(?!.*TOWER).*Critical Success

And then it was fairly easy to account for the newlines with this expression:

^(?!.*TOWER)[\s\S]*Critical Success

Now it matches the non-Tower crit, but not the Tower one on the regexr site. Perfect!

This should be a link to the test: regexr.com/8g9v0

But how to use this on FG? Using the Regex expression as a trigger does nothing.. Splitting it into different parts breaks the regex so.. I'm stumped. It works outside of FG, but not in FG.

//UPDATE 2/

Apparently the reason why this isn't working is, according to chatgpt, because Lua doesn't support Regex lookbehind or other such features. Not even \s for linebreaks or whitespace.. One would have to use code for this to work in Lua. So apparently this is a no go then.

Additional explanation offered by Chatgpt:

Why Regex Alone Doesn’t Work in Lua
Lua’s string.match() and string.find() only support basic wildcards:

. — matches any single character (not multiline)

%a, %d, %s, etc. — for letters, digits, spaces

No lookaheads or negative logic

If you need more advanced regex in Lua, you'd need to use a library like LPEG or PCRE bindings, but that’s outside the standard Lua runtime.

Zhakathoom
July 31st, 2025, 12:28
And I found a workaround:

Make one soundset that plays a sound on the trigger "Critical Success".
Make another soundset that plays no sound on the triggers "Critical Success" AND "TOWER".

Hey presto!

LordEntrails
July 31st, 2025, 15:46
Glad you got a solution and thanks for sharing!