Need help in anti-robot trigger

Post Reply
Posts: 1
Joined: Mon Aug 13, 2018 4:27 am

Need help in anti-robot trigger

Post by jackcakal »

Hello everyone,

I am new to Mudlet, and is now having problem to write a trigger to tackle an in-game anti-robot message.

here is the case:

whenever i type "locate XXX" , it will shows the direction of the item, but the way it shows is kind of graphical, and i have to figure it what is the direction, here is the actual present:

Your Position : Forest

Λ ∴ ● ∴
← > ● <=>
□ □ ∵ □↓

some of the symbol are for illusion, the actual direction is the center symbols, below are sample after removing the fake symbols,
and the direction should be "south + east" ( ● is the arrow body, ∵ is the arrow head)

Your Position : Forest


this is the first step, and all symbols are generated randomly ( can be ● Λ □ ∴ ,etc) and in different colors.
the only rule is the real symbol is in same color (could be the same as others fake symbols) , and the 2 "arrow body" is the same.
also , the numbers of symbol in each line is not certain, can be 3-5 symbols in one line

My idea is capture the whole picture first, and then try to save individual letter in table (including whitespace) , and try to analysis it afterwards (didnt think of how can do this)

But i face a problem in my first step (capturing the whole picture *cry*)
i have written a trigger like this :

Ticked "Multiline /AND Trigger for 7 line delta" and all in "perl regex"
1) ^Your Position : (\w+)$
2) ^□□□□□□□□$
3) ^(\s+)$ <<<<<<<<< a space line here
4) ^(?:\s*(.+?))(?:\s*(.+?))(?:\s*(.+?))(?:\s*(.+?))?(?:\s*(.+?))?$
5) ^(?:\s*(.+?))(?:\s*(.+?))(?:\s*(.+?))(?:\s*(.+?))?(?:\s*(.+?))?$
6) ^(?:\s*(.+?))(?:\s*(.+?))(?:\s*(.+?))(?:\s*(.+?))?(?:\s*(.+?))?$
7) ^Distance:(.*?)(\d+)

However, when i try to echo the result , line 1,2,3,7 are fine , but 4,5,6 shows the same result as 4
that is, it becomes sth like this in echo:
Your Position : Forest

Λ ∴ ● ∴
Λ ∴ ● ∴
Λ ∴ ● ∴

ps : i use multimatches to show it :
send("say " ..multimatches[1][1])
send("say " ..multimatches[2][1])
send("say " ..multimatches[3][1])
send("say " ..multimatches[4][1])
send("say " ..multimatches[5][1])
send("say " ..multimatches[6][1])
send("say " ..multimatches[7][1])

could anyone help to see what is the problem in my perl regex , or please let me know if there is a better way to do this*******

thank you so much for your help!!!

Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Need help in anti-robot trigger

Post by Jor'Mox »

So, the problem is that a multi-line trigger allows patterns to match in any order, so long as they all match within the designated number of lines, and any number of patterns can match the same line. I would split this into three triggers, the first one grabs the "header" part of this, that lets you know that you have the real stuff you care about coming up, and it would enable the second trigger. The second trigger would be something simple to capture the symbols and store its captured info in a table. So it would not be a multi-line trigger, but rather would fire three times, appending its new captures each time. And the third trigger would capture the "footer" info letting you know you were done, and do the post-processing filtering out the junk from the symbols and determining whatever it is that you would be determining from it.

By the way, the patter you have to capture the symbols looks problematic to me because everything will go into the first match, rather than being distributed in different matches as you appear to intend. This is because the first time you have .+ it will just grab everything until the end of the line, despite the ? that you follow it with in an attempt to make it non-greedy. But since each symbol is just ONE symbol, you should just be able to use . in place of .+, and it should work fine.

Post Reply