Hey all. I was wondering if there was any way to put pauses into mprogs. For instance, having a minstrel type mob able to tell a story longer than 2 or 3 lines with enough time for someone to actually read before the next few lines come up. I know I've seen this other places, but not sure what kind of codebase was used. Thanks for the help!
pauses in mprogs
Posted by Ellie on Mon 05 Jan 2004 03:35 PM — 6 posts, 23,052 views.
The only codebase Ive seen that it actually works on is Dawn of Time though there may be others. I used it quite extensively in our newbie academy on SB:R and if you want to test it, the syntax would be something like mpq <delay in seconds>
Pauses must be one of the most frequently-asked for, and hardest things to do, at both client and server end. The reason is, simply, that both ends are usually needing to do something else (eg. handle other players), so a literal "do nothing for 3 seconds" will not work.
At the server end it could be done, but you would need something like:
a) break the story into pieces
b) send one piece
c) mark the player as needing to do something in (say) 3 seconds
d) pick that up in the heartbeat loop at the appropriate time
e) allow for cancelling (eg. the player has stopped listening)
f) advance to the next piece
g) go to (b)
SMAUG does has some provisions for timed events, you could hook into that.
There have been some posts about this in the past, in fact the one about sending a story in pieces is one of them.
At the server end it could be done, but you would need something like:
a) break the story into pieces
b) send one piece
c) mark the player as needing to do something in (say) 3 seconds
d) pick that up in the heartbeat loop at the appropriate time
e) allow for cancelling (eg. the player has stopped listening)
f) advance to the next piece
g) go to (b)
SMAUG does has some provisions for timed events, you could hook into that.
There have been some posts about this in the past, in fact the one about sending a story in pieces is one of them.
Thanks for the help guys! I'll let you know what we figure out. :)
I think I might have another answer for you. If you want your programs to pause, use mpsleep. I remember something being posted here on the forum a while back about mpsleep. In fact, I liked the idea so much I added it to my mud and it has worked perfectly. Try using the forum search for a thread on mpsleep. It even has the bug fix.
From waht I've heard and read (though I'm sure there could be more), mpsleep is used in SMAUG. However, my code is SWR and I use it also. I don't even think I had to adapt anything.
Good luck.
From waht I've heard and read (though I'm sure there could be more), mpsleep is used in SMAUG. However, my code is SWR and I use it also. I don't even think I had to adapt anything.
Good luck.
Hmm, simple search. Here is the link to the thread. I think this is the solution you may be looking for.
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=2646
It gives the link to the snippet in one of the posts and the fix in the last.
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=2646
It gives the link to the snippet in one of the posts and the fix in the last.