Page 1 of 1

Capturing Two Lines of Text

Posted: Fri Apr 10, 2015 8:44 pm
by solfeggio
Hello,

I would like some advice on writing a trigger to capture and store two consecutive lines of text for my mapper script.

On any player movement, the MUD generates two consecutive lines with Room Description and Exits, such as:

A City Sidewalk
(Exits: n e w s)

How can I make a trigger that will react to the "Exits" line and also capture the previous line, which can be any string of characters? I know how to write the regex for the "Exits" line alone, but I am at a loss for how to write a two-line trigger that matches "Line 1: [Anything], Line 2: (Exits: ...)".

Any help greatly appreciated, as always!

Re: Capturing Two Lines of Text

Posted: Tue Apr 14, 2015 12:17 pm
by Belgarath
Code: [show] | [select all] lua
-- 0 (regex): .+
-- 1 (begin of line): (Exits:

local room_description = multimatches[1][1]
local exits = multimatches[2][1]
And you'll want to tick the 'multiline / AND Trigger' and set line delta to 1. Hope this helps. 8-)

Re: Capturing Two Lines of Text

Posted: Wed Apr 15, 2015 1:19 pm
by solfeggio
Thank you for having a look at this. I created the trigger you described above, and it does capture the room description and exits... but, it also captures every other line of text sent by the MUD. (I checked this by clicking the "highlight" checkbox and setting the foreground/background colors to something distinct.) Every line is matching the trigger.

I did verify that Multiline/ALL is selected, and line delta set to 1.

Re: Capturing Two Lines of Text

Posted: Thu Apr 16, 2015 7:47 am
by Belgarath
I tested it myself and it only captured my room exits and the previous line. I'm not sure why it is matching every line for you.