Examine the following single-line trigger:
It works as it should. See the following test:
Output:
Now try the same thing with a multi-line trigger:
With the following test:
There is no output. It does not match. However, if I open the trigger in the configuration window -do nothing- and click "OK" then it works as expected with the following output:
So for some reason these triggers aren't being evaluated when added by AddTriggerEx() and subsequently set as a multi-line trigger with SetTriggerOption().
Trigger = [[^You poke (?P<thing>.+)\.$]]
Script = [[print("Poke: %<thing>")]]
AddTriggerEx("Test_Trigger", Trigger, Script,
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace
+ trigger_flag.KeepEvaluating, -1, 0, "", "", 12, 0)It works as it should. See the following test:
You poke a rock.Output:
Poke: a rock.Now try the same thing with a multi-line trigger:
Trigger = [[^You poke (?P<thing1>.+)\.$\n^You prod (?P<thing2>.+)\.$]]
Script = [[print("Poke: %<thing1>")
print("Prod: %<thing2>")]]
AddTriggerEx("Test_Trigger", Trigger, Script,
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace
+ trigger_flag.KeepEvaluating, -1, 0, "", "", 12, 0)
SetTriggerOption("Test_Trigger", "multi_line", "y")
SetTriggerOption("Test_Trigger", "lines_to_match", "2")With the following test:
You poke a rock.
You prod a rock.There is no output. It does not match. However, if I open the trigger in the configuration window -do nothing- and click "OK" then it works as expected with the following output:
Poke: a rock
Prod: a rockSo for some reason these triggers aren't being evaluated when added by AddTriggerEx() and subsequently set as a multi-line trigger with SetTriggerOption().