Trigger getting the best of me :(

Post Reply
Delrayne
Posts: 159
Joined: Tue Jun 07, 2011 7:07 pm
Contact:

Trigger getting the best of me :(

Post by Delrayne »

ok, I have two multi-line triggers that I want to trigger off of.

Trigger One:
Code: [show] | [select all] lua
You stare at Isabella, giving her the evil eye.
Her curseward has failed!
You stare at Isabella, giving her the evil eye.
Trigger Two:
Code: [show] | [select all] lua
You stare at Isabella, giving her the evil eye.
You stare at Isabella, giving her the evil eye.

Now, I can get them to fire just fine...The problem i'm running into is, trigger two is making the first line of trigger one give an aff.

Here are my coded triggers and accompanying code.

Trigger One:
Code: [show] | [select all] lua
^You stare at (\w+), giving \w+ the evil eye\.$  --perl regex
^(His|Her) curseward has failed\!$  -- perl regex
^You stare at (\w+), giver \w+ the evil eye\.$ -- perl regex
line delta 3
 
--Lua Code
if (multimatches[1][2] == target.name) then
        target.curseward = false
        if (not table.contains(target.afflictions, aff2) then
                targAffAdd(aff2)       
        end
        printTargetWindow()
end
Trigger Two:
Code: [show] | [select all] lua
^You stare at (\w+), giving \w+ the evil eye\.$  --perl regex
1   -- Line Spacer
^You stare at (\w+), giving \w+ the evil eye\.$  --perl regex
line delta 2
 
--Lua Code
if (multimatches[1][2] == target.name) then
        if (not table.contains(target.afflictions, aff1) then
                targAffAdd(aff1)
        end
        if (not table.contains(target.afflictions, aff2) then
                targAffAdd(aff2)
        end
        printTargetWindow()
end
I can't for the life of me figure out how to make Trigger Two stop making Trigger One's first line from adding an affliction to the target. Any and all help is appreciated.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Trigger getting the best of me :(

Post by Heiko »

I'm not sure if I understand correctly what you're trying to do, but if you want trigger 2 to stop trigger one from firing you simply move trigger 2 before trigger one on the trigger tree to make it match the line before trigger one and set a lock value for trigger one that you catch with additional Lua conditions e.g. if triggerTwoLock == 1 then return false else return true. Then you need to add a third trigger after trigger one that matches on every line and removes triggerTwoLock e.g.
trigger three: perl pattern:.
script:triggerTwoLock = 0
And you need to define the variable triggerTwoLock in your global variable declaration script.

Alternatively you can disable trigger one if trigger two matches and enable it again in your trig 3.

Post Reply