Need some Help

Post Reply
akillpack
Posts: 4
Joined: Sat Sep 10, 2011 7:47 am

Need some Help

Post by akillpack »

Hey I'm new to Mudlet and scripting/Regex for that matter. I play DSL (Dark and Shattered Lands) and I am having a really fun time learning it and I have gotten quite a few things down but I have been trying to get the Multiline match trigger thing to work and I seem to be doing it wrong. I am trying to make a trigger that fires when:

(A|An|The| |) (.*) walks (\w+). <Regex>
has fled! <substring>

appears and sends the following:

send ( "move " .. matches[4] )
send ( "murder " .. matches[3] )

its working for the most part as far as recognizing the variables but will fire every time its sees the first line. I also am not sure if just putting | | will allow the regex to recognize nothing in front. If you could help me out Id really appreciate it.

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Need some Help

Post by Rakon »

You need to check the box 'multiline AND trigger', to match one the requirements of BOTH lines.

After that, your matches will be stored in the 'multimatches' table, not 'matches'

Use the function showMultimatches() to see the table of those matches in your trigger script.

akillpack
Posts: 4
Joined: Sat Sep 10, 2011 7:47 am

Re: Need some Help

Post by akillpack »

Ah so thats why it wasnt working when I was clicking the multiline matches box it has to be .. multimatches not just .. matches. For the function showMultimatches () can i just use the one thats in the manual?
multimatches {
1 = {
matches[1] of regex 1
matches[2] of regex 1
matches[3] of regex 1
...
matches[n] of regex 1 },
2 = {
matches[1] of regex 2
matches[2] of regex 2
...
matches[n] of regex 2 },
... ...
n = {
matches[1] of regex n
matches[2] of regex n
...
matches[n] of regex n }
}

and final question, that was not very clear from the manual. [1] [2] [3] etc equal the variables [1] being the whole line etc. If i want to use something from the second or third condition does it increase numerically or do i do mutlimatchs[1][3] where [1]= first line [3]= third variable. Thanks so much for the help!

User avatar
Omni
Posts: 131
Joined: Fri Feb 12, 2010 10:26 am

Re: Need some Help

Post by Omni »

First match is multimatches[1], all others increase by one. So second is multimatches[2], and so on and so forth.

akillpack
Posts: 4
Joined: Sat Sep 10, 2011 7:47 am

Re: Need some Help

Post by akillpack »

For future reference is I had Regex in other lines would i use multimatch[][]?

Skylark
Posts: 46
Joined: Mon Feb 22, 2010 12:38 am

Re: Need some Help

Post by Skylark »

Yup

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Need some Help

Post by Vadi »

Regex

akillpack
Posts: 4
Joined: Sat Sep 10, 2011 7:47 am

Re: Need some Help

Post by akillpack »

I have another fairly general question, this one about tables. Do i need to go in an set up a table in the scripts option or will adding function showMultimatches() create one for me. If i do need to create one I tried making one early and modeled it after the one in the manual but it kept giving me the little bug error conceding the }. Thanks again for the help

Post Reply