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
➜ SMAUG
➜ SMAUG coding
➜ Time Delay
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Neves
USA (78 posts) 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? | Top |
|
Posted by
| Kain
USA (43 posts) Bio
|
Date
| Reply #1 on Sat 27 Jul 2002 06:30 PM (UTC) |
Message
| I'm pretty sure that C has a sleep() function... | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) 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 | Top |
|
Posted by
| Neves
USA (78 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) 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 | 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,654 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top