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
➜ Command Delay
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Drakonik
(20 posts) Bio
|
Date
| Sun 09 Dec 2007 01:30 AM (UTC) |
Message
| The MUD I play just implemented a 2 command buffer, with a .5 second delay between commands. What I want to do is to put a .6 second delay between ALL commands. That means aliases, macros, triggers, and even commands which I queue up using the command stacking.
Is this even possible? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 09 Dec 2007 04:43 AM (UTC) Amended on Sun 09 Dec 2007 04:44 AM (UTC) by Nick Gammon
|
Message
| Yes I think you could do this. I am not at my PC right now, but the general technique would be to:
- Make a plugin that implements the function OnPluginSend to capture all attempts to send data to the MUD. See:
http://www.gammon.com.au/scripts/doc.php?general=plugin_callbacks
- Instead of allowing it to be sent, it would store it into a queue (for later sending), and return 'false' so the text is not sent right now.
- Make a timer that fires every 0.6 seconds. This timer pulls out the first item from the queue mentioned above (if any), and sends it.
- The plugin would need some sort of internal flag, so it knows when the timer fires to allow the text to be actually sent, rather than re-appended to the queue.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Mccane
(28 posts) Bio
|
Date
| Reply #2 on Sat 22 Dec 2007 12:37 PM (UTC) |
Message
| You might want to make some kind of check where when you send the command, it checks your queue to see if it has anything in it. If it doesn't, the command is executed immediately and then turns queuing on so that for the next 0.6 seconds, additional commands are queued and if other commands are entered, it keeps queuing commands for 0.6 seconds until you stop entering commands. If you don't do this, I think everytime you enter a simple command like who or look, it'll wait queue the command and won't execute for 0.6 seconds, which might get a tad bit annoying. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sat 22 Dec 2007 07:30 PM (UTC) |
Message
| Yes I agree, although that could be fiddly to implement. Just checking the queue is empty and sending immediately won't work, as you might have sent something 0.1 seconds earlier.
Quote:
... everytime you enter a simple command like who or look, it'll wait queue the command and won't execute for 0.6 seconds ...
Not quite. It will execute in a maximum of 0.6 seconds. If the timer fires every 0.6 seconds, then it might be about to fire anyway (like 0.001 seconds later). The way I suggested you would wait a maximum of 0.6 seconds for individual commands, and therefore the average wait would be 0.3 seconds. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
17,154 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top