Multiline script with the same pattern 7 times

All and any discussion and development of the Mudlet Mapper.
Post Reply
corben
Posts: 2
Joined: Fri Sep 16, 2022 8:00 am

Multiline script with the same pattern 7 times

Post 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 695 times
example2.png
example2.png (8.25 KiB) Viewed 695 times
Thanks!
Corben

User avatar
demonnic
Posts: 825
Joined: Sat Dec 05, 2009 3:19 pm

Re: Multiline script with the same pattern 7 times

Post 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.

corben
Posts: 2
Joined: Fri Sep 16, 2022 8:00 am

Re: Multiline script with the same pattern 7 times

Post 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!

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

Re: Multiline script with the same pattern 7 times

Post 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.

Post Reply