Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ a few questions regarding triggers
a few questions regarding triggers
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Acton
(13 posts) Bio
|
Date
| Mon 02 Jun 2008 10:04 PM (UTC) |
Message
| 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, | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 02 Jun 2008 10:18 PM (UTC) |
Message
|
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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Acton
(13 posts) Bio
|
Date
| Reply #2 on Mon 02 Jun 2008 10:41 PM (UTC) |
Message
| 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.
| Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
12,493 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top