Difference between revisions of "Manual:DIL Manual/block"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
| + | = block = | ||
| + | '''Procedure.''' Stops the event that woke the program from going any further. | ||
| + | block; | ||
| − | < | + | Most often used after <code>wait(SFB_CMD, ...)</code>: 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 (<code>wait</code>, <code>pause</code>), and it doesn't carry over to the next event. | ||
| + | * What it stops depends on the event: | ||
| + | ** <code>SFB_CMD</code>: the command never runs. | ||
| + | ** <code>SFB_PRE</code>: the spell or the damage that is about to happen doesn't happen. | ||
| + | ** <code>SFB_DONE</code>, <code>SFB_MSG</code> 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 <code>fnpri</code> order, lowest number first. A program that blocks must have a lower <code>fnpri</code> than the programs it should keep the command from. | ||
| + | * <code>block</code> followed by <code>quit</code> still blocks. | ||
| + | |||
| + | == Example == | ||
| + | <pre> | ||
| + | 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 | ||
| + | </pre> | ||
| + | Keeps mortal players from quitting in the arena. Adapted from arena.zon. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual/wait()|wait()]] | ||
| + | * [[Manual:DIL Manual/command()|command()]] | ||
| + | * [[Manual:DIL Manual/fnpri|fnpri]] | ||
| + | * [[Manual:DIL Manual/priority|priority]] | ||
| + | * [[Manual:DIL Manual/SFB CMD|SFB_CMD]] | ||
| + | * [[Manual:DIL Manual/SFB PRE|SFB_PRE]] | ||
Latest revision as of 23:23, 14 November 2026
Contents
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_MSGand 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
fnpriorder, lowest number first. A program that blocks must have a lowerfnprithan the programs it should keep the command from. blockfollowed byquitstill 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.