Capturing MATCHES on Multiline Triggers

edited August 2015 in Client Help
^\[System\]\: Running queued balance command\: SWIFTCURSE (\w+) (.+)$
^You point an imperious finger at \w+.$
Did a multiline trigger and selected the delta to be 1 line. I was trying to capture matches[3] on the first line, the bold one. When I do echo(matches[3]) nothing happens. I am using Mudlet.

How should I capture that?


Comments

  • If you're using a multiline trigger, the matches are stored in a different table: multimatches. To access the second group on the first line, you'd want multimatches[1][3].

  • @Antonius Why are you so smart! Thank you!
  • AustereAustere Tennessee
    Before you go any further, add stand/wield shield doll to that.  It's going to save you the hassle of doing so later.  I capture my none serverside alias swifts a bit different and will post my method when I am not on a phone, if you want. 


  • Austere said:
    Before you go any further, add stand/wield shield doll to that.  It's going to save you the hassle of doing so later.  I capture my none serverside alias swifts a bit different and will post my method when I am not on a phone, if you want. 


    Yes I WANT WANT.
  • AustereAustere Tennessee
    edited September 2015
    Sorry about this..I completely forgot I was supposed to do it and no one reminded me. For some strange reason at work today, I remembered it. Better late than never:

    ^\[System\]\: Running queued balance command\: (.+)$
    ^You point an imperious finger at \w+.$ cursedraw = multimatches[1][2] cursedraw = cursedraw:split(" ") for k,v in pairs(cursedraw) do
    if string.findPattern(cursedraw[k],"swiftcurse") then
    nextcurse = k+2
    end
    if string.findPattern(cursedraw[k],"blight") then
    nextcurse = k+2
    end
    if string.findPattern(cursedraw[k],"curse") then
    nextcurse = k+2
    end
    if string.findPattern(cursedraw[k],"relapse") then
    invoked = k+1
    end
    if string.findPattern(cursedraw[k],"invoke") then
    invoked = k+2
    end
    if string.findPattern(cursedraw[k],"imbibe") then
    imbibedraw = k+1
    end
    end


  • If you don't mind me asking, what exactly is the code doing?
  • edited September 2015
    It detects what curse is being sent based on what command was sent in the queue before it. Also checks for other things like soulscourge, blight, relapse etc.

    Basically it takes the queue string, seperates it into an array, one word in each element of the array, then checks the array for specific words and knowing swiftcurse is the word it's looking at for instance, looks two ahead in the array to figure out what curse was sent.
  • @Austere Thank you, I didn't know it can be done this way, was using different triggers to catch them!
Sign In or Register to comment.