Manual:DIL Manual/block

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:23, 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

block

Procedure. Stops the event that woke the program from going any further.

block;

Most often used after wait(SFB_CMD, ...): the command is not carried out, and no program after this one, on this unit or on the units around, gets it. The program then answers the command its own way.

Notes

  • It applies to the event that woke the program this time. It can come anywhere before the program waits again (wait, pause), and it doesn't carry over to the next event.
  • What it stops depends on the event:
    • SFB_CMD: the command never runs.
    • SFB_PRE: the spell or the damage that is about to happen doesn't happen.
    • SFB_DONE, SFB_MSG and the others: the event has already happened; only the programs after this one don't hear of it.
  • A unit's programs get each event in fnpri order, lowest number first. A program that blocks must have a lower fnpri than the programs it should keep the command from.
  • block followed by quit still blocks.

Example

dilbegin no_quit();
code
{
   :start:
   wait(SFB_CMD, command("quit") and (activator.level < IMMORTAL_LEVEL));
   block;
   act("For your safety you must withdraw from the arena to quit.",
       A_ALWAYS, activator, null, null, TO_CHAR);
   goto start;
}
dilend

Keeps mortal players from quitting in the arena. Adapted from arena.zon.

See also