[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

# Re: MOOcode level race condition with read() and force_input()

- Date: Wed, 30 Jul 1997 12:11:20 +0200 (METDST)
- From:
- Cc: moo-cows@the-b.org
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=US-ASCII
- In-Reply-To: <3.0.1.32.19970729155948.0081cc20@po.scinc.com> from "Andy Bakun" at Jul 29, 97 03:59:48 pm

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

- Re: read() and force_input()

- From: Andy Bakun <abakun@scinc.com>

References:

- MOOcode level race condition with read() and force_input()

- From: Andy Bakun <abakun@scinc.com>

- Prev by Subject: MOOcode level race condition with read() and force_input()
- Next by Subject: moving things out of the server (was: floats and efficiency)
- Prev by thread: MOOcode level race condition with read() and force_input()
- Next by thread: Re: read() and force_input()
- Index(es):
  - Subject
  - Thread

Home | Subject Index | Thread Index