MOO-cows Mailing List Archive
[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: MOOcode level race condition with read() and force_input()
>
>If I have a loop that prompts the user (via $command_utils:yes_or_no) as to
>if a certain command should be executed for them (which will happen via
>force_input(), but I don't explictly say that in the prompt)... well, this
>would best be explained with a code example:
>
>for cmd in (commands)
> ok = $command_utils:yes_or_no("Execute ", command, "?");
> ok && force_input(player, cmd);
>endfor
I actually managed to get this working (if I get your intentions right) with
the following code:
commands = {":1", ":2", ":3"};
for command in (commands)
ok = $command_utils:yes_or_no(tostr("Execute ", command, "?"));
ok && force_input(player, command, 1);
suspend(0);
endfor
the ,1 makes sure the input is entered at the front of the queue, and the
suspend(0) gives the server time to dequeue the command. I tested it and it
seemed to work fine for me.
Pieter-Bas
Follow-Ups:
References:
Home |
Subject Index |
Thread Index