I managed to take the wait.lua that's supplied with MUSHclient and apply it to the Lua code for SMAUG. The following is the output of the accept function from a test task. Note the timestamp in the prompt.
And here's the accept function:
To get this to work, I added
to the startup.lua script and, as the comment states, I added a call to it in the violence_update() function in fight.c.
Ranger Richard tells you 'I was going to tell you something, but...
Accepted task: Test
<[Thu Jan 17 05:15:21 2008] 30045ma 44gp [Room: 21126] >
Ranger Richard tells you 'I've forgotten what it was.
<[Thu Jan 17 05:15:22 2008] 30045ma 44gp [Room: 21126] >
Ranger Richard tells you 'No bother. I'll think of it later.
<[Thu Jan 17 05:15:24 2008] 30045ma 44gp [Room: 21126] >
Ranger Richard tells you 'Oh yeah! I can pause in my speech.
<[Thu Jan 17 05:15:34 2008] 30045ma 44gp [Room: 21126] >
And here's the accept function:
accept = function ()
function cl ()
send ("&WRanger Richard tells you 'I was going to tell you something, but...")
wait.wpause(1)
send ("&WRanger Richard tells you 'I've forgotten what it was.")
wait.wpause(1)
send ("&WRanger Richard tells you 'No bother. I'll think of it later.")
wait.wpause(10)
send ("&WRanger Richard tells you 'Oh yeah! I can pause in my speech.")
end
wait.make(cl)
end,
To get this to work, I added
wait_update = require("wait").update -- called during violence_update() to update any pauses in scriptsto the startup.lua script and, as the comment states, I added a call to it in the violence_update() function in fight.c.
in fight.c:violence_update()
lst_ch = NULL;
pulse = (pulse+1) % 100;
for ( ch = last_char; ch; lst_ch = ch, ch = gch_prev )
{
set_cur_char( ch );
call_lua(ch, "wait_update", NULL);
if ( ch == first_char && ch->prev )
{
bug( "ERROR: first_char->prev != NULL, fixing...", 0 );
ch->prev = NULL;
}