Manual:DIL Manual/waitnoop

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:15, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

waitnoop

Instruction. Steps out of the current event for a moment.

waitnoop;

The program stops here and runs on almost at once: in the same pass of the game's event queue, after the event that woke it has been dealt with. A follower woken by its master's move (an SFB_DONE event) uses it so that the master's command finishes, and the other programs get the event, before the follower runs a command of its own with exec().

It is written without parentheses: waitnoop(); is a syntax error.

Notes

  • Nothing else wakes the program while it waits: no commands, messages or ticks, and no interrupt() or on_activation() fires. Those events are lost to it, not queued.
  • Coming back is a wake like any other. Every unitptr variable that isn't secured is null afterwards, and activator, argument, cmdstr and the others no longer describe the old event. Copy what you need into variables first.
  • Secures are tested at the wake. If the command that was running took a secured unit away (a master who walked out, say), the program goes to that secure's label instead.
  • Don't use it while a program before this one on the unit (lower fnpri) may hold priority: the wake is then dropped, and the program never runs again.
  • basemove.zon (the follow command) is the only user in the game.

Example

dilbegin fnpri(FN_PRI_MISSION) tagalong();
var
   c : string;
code
{
:start:
   wait(SFB_DONE, activator == self.master);
   if (command("north") or command("east") or command("south") or
       command("west") or command("up") or command("down"))
   {
      c := cmdstr;
      waitnoop;
      exec(c, self);
   }
   goto start;
}
dilend

When its master has moved, the NPC takes the same exit, as dilfollow in basemove.zon does. cmdstr goes into c before the waitnoop, because it describes another event afterwards.

See also