[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]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Time Delay
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Time Delay

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


Posted by Neves   USA  (78 posts)  [Biography] bio
Date Wed 24 Jul 2002 10:53 PM (UTC)
Message
I'm interested in there being a slight delay in the quitting sequence, but I'm not sure what command to use.

What I want is:
ch_printf( ch, "You pack your bags and prepare to leave.\n\r" );
<Delay of two seconds>
ch_printf( ch, "You pick up your bags and leave the game..." );

Does anyone know a way I can set it to have a two second delay between these two ch_printfs?
[Go to top] top

Posted by Kain   USA  (43 posts)  [Biography] bio
Date Reply #1 on Sat 27 Jul 2002 06:30 PM (UTC)
Message
I'm pretty sure that C has a sleep() function...
[Go to top] top

Posted by Nick Gammon   Australia  (21,609 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Thu 01 Aug 2002 05:27 AM (UTC)
Message
The sleep function won't work the way you want - if you used it all players would have a 2 second delay, not just the one who was quitting.

You could do it by changing the status of the player (eg. to CON_QUITTING) and detect that in the nanny routine.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Neves   USA  (78 posts)  [Biography] bio
Date Reply #3 on Thu 01 Aug 2002 12:30 PM (UTC)
Message
I'm not sure exactly what you mean, I know how to change him to CON_QUITTING, but what would I add to the nanny function to send a delay only to that specific player?

-Nev
[Go to top] top

Posted by Nick Gammon   Australia  (21,609 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Fri 02 Aug 2002 05:39 AM (UTC)
Message
Upon thinking about it, I withdraw that suggestion. :)

That would only work if they typed something.

You would have to somehow put a flag on that player that got picked up in the timer loop (update loop) that does things periodically (like make you thirsty).

However maybe a combination would do it. Set the status to CON_QUITTING, so they can't type any more commands (if you get a command in nanny when the status is quitting, you could say "you are leaving now"). Then in the update routine, if you detect that status, send the second message and disconnect them.

- 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.


4,796 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]