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.
Are these going to arrive all at the same time? Or at intervals? Will something separate them (prompt, etc)?
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.
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.
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?
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
Very helpful, much thanks Nick.