Page 1 of 1

Multiline script with the same pattern 7 times

Posted: Fri Sep 16, 2022 10:33 am
by corben
Hello!

I'm new to LUA and to Mudlet but I was able to get some first results. I'm trying to map the Wilderness of an Italian MUD, but I can't get the trigger right.

This mud changes the wilderness size, but it is ALWAYS a set of 7 lines of 13 characters each. When the visibility is blocked, empty spaces are displayed, but always of len 13.

I managed to find strings of exactly 13 characters like this: \W{13}\n|.{6}X.{6}\n

My question is: how should I set the multiline trigger so that it fires only when this is recognized in 7 consecutive lines?

I attach a couple of screenshots of the wilderness for more clarity...
example.png
example.png (10.64 KiB) Viewed 6160 times
example2.png
example2.png (8.25 KiB) Viewed 6160 times
Thanks!
Corben

Re: Multiline script with the same pattern 7 times

Posted: Fri Sep 16, 2022 3:51 pm
by demonnic
Is there anything it consistently sends before the name of the tile? If so, it may be that a trigger chain will be an easier fit. Otherwise, I'll have to think about how best to ensure the same line matches in 7 different lines without using the same pattern followed by a line spacer 1, repeated 7 times.

That would work, but I'd like to think there's a better way.

Re: Multiline script with the same pattern 7 times

Posted: Sat Sep 17, 2022 1:47 pm
by corben
demonnic wrote:
Fri Sep 16, 2022 3:51 pm
Is there anything it consistently sends before the name of the tile? If so, it may be that a trigger chain will be an easier fit. Otherwise, I'll have to think about how best to ensure the same line matches in 7 different lines without using the same pattern followed by a line spacer 1, repeated 7 times.

That would work, but I'd like to think there's a better way.
Unfortunately no, usually it is the prompt, but there might be variations (mobs entering the room, etc.). I'm not familiar with trigger chain, but I'll dig into it... My best guess was to buffer the lines in a global variable/table and "consume" it once a length of 7 is reached, but I hoped there was a better way too...

Thanks for your hits!

Re: Multiline script with the same pattern 7 times

Posted: Mon Sep 19, 2022 10:23 pm
by Jor'Mox
So, what I would do is have a trigger that grabs every line, and pops it into an array, which stores the last 8 or so lines (however many you need so when the exits line shows up, you have the whole map). And then have a separate trigger that fires when the exits line shows up, you know you have your map, and you can use what is stored in your array.