Closed crnormand closed 2 years ago
The reason for the pull request is that I was trying to add some flavor to a map by using:
@Drawing[DetectB]@Trigger[move capture]@OTF[/if [!PER] You see something interesting in the flames... ]
If the player moves their token onto drawing "DetectB", it will quietly perform an IF check to see if the character passed a blind PERception roll, and if they did... it will report "You see something interesting in the flames..."... at which point, I will take over narration as the GM.
@crnormand kk i will make some test, but it's seem good to me. Ty for the contribution.
It works with my current set of triggers:
@Drawing[Up1]@Trigger[move capture]@Teleport[Second Floor/Dn2]
@Drawing[PortA]@Trigger[move capture]@Teleport[PortB]@OTF[1d-3 burn]@OTF[!/wait 500\\/anim flames*orange*200 c270 *2 @self]
@Drawing[PortB]@Trigger[move capture]@Teleport[PortA]@OTF[1d-3 burn]@OTF[!/wait 500\\/anim flames*orange*200 c270 *2 @self]
@Drawing[Dn1]@Trigger[move capture]@Teleport[Cellar/Upc]
@Drawing[DetectB]@Trigger[move capture]@OTF[!/if [!PER] You see something odd in the flames... ]
@Drawing[ChatOn]@OTF[/:ChatterOn]
@Drawing[ChatOff]@OTF[/:ChatterOff]
@Drawing[ChatKalrell]@OTF[/:ChatterKalrell]
Oh, and thank you!
I added a new Trigger Happy entity in the GURPS Game Aid for Foundry code (https://foundryvtt.com/packages/gurps), using the game.triggers.registerEffect() function:
@OTF[]
OTF stands for "On the Fly", a syntax that allows the user to create buttons (and perform actions) "on the fly". You can see the complete syntax (and examples) here: https://docs.google.com/document/d/1NMBPt9KhA9aGG1_kZxyk8ncuOKhz9Z6o7vPS8JcjdWc/edit#heading=h.4i42gorf4hic
The player can edit their character sheet and enter in text like:
[PER]
(which creates a button that will roll the Perception attribute of the character, or they can create something more complex like:["Acrobatic Dodge"/if [Sk:Acrobatics] [Dodge+2] /else [Dodge-2]]
Which will create a button with the label "Acrobatic Dodge". When the button is pressed, it will execute the Skill check for the Acrobatics skill, and if successful, it will roll against the characters Dodge with a +2 modifier, otherwise it will roll against Dodge at a -2.
As you can see... OTF formulas rely on square brackets, and the original regex would match:
["Acrobatic Dodge"/if [Sk:Acrobatics] [Dodge+2] [Dodge-2]]
to["Acrobatic Dodge"/if [Sk:Acrobatics]
which was not complete.This Pull Request updates the regex to allow at least 2 levels of matched square brackets.
I found this example of how to match balanced brackets here: https://stackoverflow.com/questions/546433/regular-expression-to-match-balanced-parentheses