Multiline trigger fires inconsistently.

Post Reply
Elirian
Posts: 2
Joined: Tue Apr 24, 2018 12:59 pm

Multiline trigger fires inconsistently.

Post by Elirian »

Ok, I'm pretty sure I'm missing something small, but I've spent a lot of time trying to figure it out and can't. I have a multiline trigger set up that disables itself after firing, and an alias to enable it, then send a command to the mud that will prompt the mud to respond with the lines that fire the trigger. The problem I am having is that every second time, the trigger will fire after having received only one matching line from the mud. If I make the line delta larger, it becomes less consistent, for example at delta 6, it fires early 3/4 times.

Alias:

Code: Select all

Alias name=statbar
Pattern=stat
Script=
enableTrigger("statbartrigger")
send ("stat", false)
Trigger:

Code: Select all

name=statbartrigger
0=OB: (\d+)%, DB: (\d+)%, PB: (\d+)%, Armour: (\d+)%. Wimpy: (\d+). Mood: (\w+). (perl regex)
1=Needed: (\d{1,3},?\d{0,3},?\d{0,3}) xp, (\d{1,3},?\d{0,3},?\d{0,3}) tp. Gold: (\d{1,3},?\d{0,3},?\d{0,3}). Alert: (\w+). (perl regex)

fire length=1 more lines
multiline/AND trigger=yes
     line delta=1
script=
display(multimatches)
disableTrigger("statbartrigger")
output:

Code: Select all

stat
OB: 3%, DB: 28%, PB: 0%, Armour: 0%. Wimpy: 48. Mood: wimpy.
Needed: 923 xp, 0 tp. Gold: 0. Alert: normal.{
  {
    "OB: 3%, DB: 28%, PB: 0%, Armour: 0%. Wimpy: 48. Mood: wimpy.",
    "3",
    "28",
    "0",
    "0",
    "48",
    "wimpy"
  },
  {
    "Needed: 923 xp, 0 tp. Gold: 0. Alert: normal.",
    "923",
    "0",
    "0",
    "normal"
  }
}
stat
OB: 3%, DB: 28%, PB: 0%, Armour: 0%. Wimpy: 48. Mood: wimpy.{}
Needed: 923 xp, 0 tp. Gold: 0. Alert: normal.
debug output:

Code: Select all

Alias name=statbar(stat) matched.
Alias: capture group #1 = <stat>
LUA OK script statbar (Alias8) ran without errors
new line arrived:OB: 3%, DB: 28%, PB: 0%, Armour: 0%. Wimpy: 48. Mood: wimpy.

LUA OK script prompt (trigger1condition0) ran without errors
Trigger name=statbartrigger(OB: (\d+)%, DB: (\d+)%, PB: (\d+)%, Armour: (\d+)%. Wimpy: (\d+). Mood: 
(\w+).) matched.
capture group #1 = <OB: 3%, DB: 28%, PB: 0%, Armour: 0%. Wimpy: 48. Mood: wimpy.>
capture group #2 = <3>
capture group #3 = <28>
capture group #4 = <0>
capture group #5 = <0>
capture group #6 = <48>
capture group #7 = <wimpy>
match state 1/1 condition #0=true (0/2) regex=OB: (\d+)%, DB: (\d+)%, PB: (\d+)%, Armour: (\d+)%. 
Wimpy: (\d+). Mood: (\w+).
LUA OK script statbartrigger (Trigger2) ran without errors
new line arrived:Needed: 923 xp, 0 tp. Gold: 0. Alert: normal.

LUA OK script prompt (trigger1condition0) ran without errors
new line arrived:!#>

LUA OK script prompt (trigger1condition0) ran without errors
Trigger name=prompt(return isPrompt()) matched.

line under current user cursor: 946#:!#>
P_begin(0/946), P_end(3/946) selectedText = !#>
LUA OK script prompt (Trigger1) ran without errors
I don't know what I've done, I guess it's something embarrassingly small, any help would be appreciated.

Brenex
Posts: 3
Joined: Thu Feb 01, 2018 7:52 am

Re: Multiline trigger fires inconsistently.

Post by Brenex »

Try this (I changed the second line a little bit more below):

Image

Code: Select all

^OB: (\d+)%, DB: (\d+)%, PB: (\d+)%, Armour: (\d+)%\. Wimpy: (\d+)\. Mood: (\w+)\.$

Code: Select all

^Needed: ([\d,]+) xp, ([\d,]+) tp\. Gold: ([\d,]+)\. Alert: (\w+)\.$
Attachments
unknown.png

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Multiline trigger fires inconsistently.

Post by Jor'Mox »

Try setting your fire length to 0, but leave your line delta at 1.

Elirian
Posts: 2
Joined: Tue Apr 24, 2018 12:59 pm

Re: Multiline trigger fires inconsistently.

Post by Elirian »

That works, thanks heaps :) I'll try to figure out why now!

Post Reply