Register forum user name Search FAQ

Gammon Forum

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 ➜ Matching Lines Triggers

Matching Lines Triggers

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by LupusFatalis   (154 posts)  Bio
Date Mon 11 May 2009 05:56 PM (UTC)
Message
Alright, I'm wondering if there is a way to do the following easily. I would like to make a trigger that will look at the next line if one exists. And if it matches return a result according to that.

I.E. if I get the line:

Ping!

from the mud I want the trigger to send: "say 1 Ping(s)"

But if i receive:

Ping!
Ping!
Ping!

I want to have it send: "say 3 Ping(s)"

Its not a critical issue, and if it involves much scripting or timers its not worth it. But if there was a quick and elegant way to handle it, I'd like to try it.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Mon 11 May 2009 06:02 PM (UTC)
Message
Are these going to arrive all at the same time? Or at intervals? Will something separate them (prompt, etc)?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #2 on Mon 11 May 2009 10:03 PM (UTC)
Message
They will arrive all at the same time, not in intervals. And Nothing will be separating them. Or if anything does, I don't want them to register in the same set anyway. However, I guess if there is for some reason a huge string of them, they may not arrive in the same packet.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 11 May 2009 10:51 PM (UTC)
Message
I think two triggers would do it. First, one to match on "Ping!" which simply adds one to a "ping counter". This would have a low sequence number (eg. 10) and not have "keep evaluating" checked.

Then another trigger which matches anything (ie., "*"). This would have a higher sequence number than the first (eg, 11), and have "keep evaluating" checked so that other triggers also match.

In the second trigger, if the ping counter is greater than zero you display the ping counter (eg. 3 pings), and then set it to zero. That way you only display the pings if you reach the end of the ping list.



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #4 on Tue 12 May 2009 05:24 PM (UTC)
Message
Thanks Nick, works well. I just had to make the first ping force the mud to send me more text after thing pinging goes through. i.e. if var = 0 send look

elsewise it doesn't actually fire until the mud sends me something other than a ping

So whats the deal with the sequence, things lower in the sequence get evaluated first? Might be handy in the future too.

Where do plugin's come in relation to this... Obviously the add new line to prompt plugin firing on packet receiving is first. But is there a way I can give certain plugins priority over other should I need to?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 13 May 2009 01:25 AM (UTC)
Message
Lower sequence is evaluated first. Thus by combining sequence numbers with keep evaluating, or not, you can control in what order triggers are evaluated, and whether further ones down the list are checked also.

No you can't give plugins priority. However a callback like packet receiving is done before trigger checking. In other words, all plugins are checked for something like an incoming packet, before all plugins are checked for triggers.

For more details, see:

http://www.gammon.com.au/forum/?id=6554

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #6 on Wed 13 May 2009 02:10 AM (UTC)
Message
Very helpful, much thanks Nick.
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.


23,096 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.