[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Command Delay
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Command Delay

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


Posted by Drakonik   (20 posts)  [Biography] 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?
[Go to top] top

Posted by Nick Gammon   Australia  (21,648 posts)  [Biography] 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
[Go to top] top

Posted by Mccane   (28 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,648 posts)  [Biography] 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
[Go to top] 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.


5,005 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]