a few questions regarding triggers

Posted by Acton on Mon 02 Jun 2008 10:04 PM — 3 posts, 15,933 views.

#0
Hello,
I've got a few questions, on how to do something.
First, Is there some quick tutorial on regexp?
I know how it works a bit, but I'm not the best with it.
Also, if I do something like: ^hello my name is *.$, the $ is the end of the line. how do I access what was in the * position with a php script?
I'm also working on two things.
First, I need to be able to parse a who list, which is on multiple lines. is there a way that this can be done, efficiently? I see the player name, and location. I want to trigger on the location, but each player is on a separate line.
Second, and this is two-part, I've got a line that has 5 parts to it.
Now, I want to start on the right, and act on each one. so I'll have like:
The meter reads: * * * * and *
is there an efficient way to do this? I need to start on the right, and do a test based on that, act on it, then obtain the line again until a trigger is matched.
So, I'll work backwards.
second, is there a way to make the client pause?
With php, when I use a sleep function, the window (program) freezes, and keeps showing a "server busy" message.
I think that's about it. I've got a list of the world functions, I'm just stuck on how to parse multiple lines, and do the 5 part line.
Thanks in advance for all the help,
Australia Forum Administrator #1
Quote:

First, Is there some quick tutorial on regexp?


http://www.mushclient.com/regexp

Quote:

Also, if I do something like: ^hello my name is *.$, the $ is the end of the line. how do I access what was in the * position with a php script?


I think you mean:


^hello my name is .*$


The "." means "any character" and the "*" means "zero or more of the previous character". Your example would match zero or more spaces as you had the * after the space.

If you using the "send" field the wildcard will be %1 in the send field, including if that is a script.

eg.


$name = "%1"


If you are using a script file the wildcards are passed down as an argument to the script function, or you can use GetTriggerWildcard, see:

http://www.gammon.com.au/scripts/doc.php?function=GetTriggerWildcard

Quote:

First, I need to be able to parse a who list, which is on multiple lines. is there a way that this can be done, efficiently? I see the player name, and location. I want to trigger on the location, but each player is on a separate line


See: http://mushclient.com/faq point 37.

Quote:

Now, I want to start on the right, and act on each one. so I'll have like:
The meter reads: * * * * and *
is there an efficient way to do this? I need to start on the right, and do a test based on that, act on it, then obtain the line again until a trigger is matched.
So, I'll work backwards.


Get the entire matching line in a script, and then do your processing in the script (you won't get the trigger to fire again, just reprocess the line in the script).

Quote:

second, is there a way to make the client pause?


See: http://mushclient.com/faq point 25.


Sounds like you haven't read the FAQ - it has heaps of useful stuff in it.
#2
Hello,
I have read the faq... thanks for your asumption that I hadn't.
Thanks for the help, I'll check out the indicated links.