Manual:DIL Manual/send()

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

send()

Procedure. Sends a message to the DIL programs around the unit.

send(msg : string)

Every DIL program around the program's own unit that is waiting for SFB_MSG (in a wait() or an interrupt()) gets the message. The receivers run at once, before send() returns. In each of them argument is the message and activator is the sender's unit; medium and target are null.

"Around" is the unit the sender is in (usually a room, but it can be a character or a container), and in this order:

  • the programs on that unit itself;
  • what the sender contains (its inventory and equipment);
  • every unit in it, and what is in the transparent ones there;
  • what the characters there wear, but not what they carry.

A sender that is a room reaches the units directly in it.

Parameters

Name Type Meaning
msg string The message. Receivers usually compare it with argument.

Notes

  • The sending program never gets its own message. The other programs on the sender's unit get it only if they are aware.
  • A program that isn't waiting for SFB_MSG at that moment misses the message; it isn't kept for later.
  • A receiver that does block stops the message there: the units after it don't get it. A receiver holding priority keeps it from the later programs on its own unit.
  • Afterwards the sender's secures are tested: if a receiver moved a secured unit away, the sender goes to that secure's label.
  • An empty (null) string sends nothing.
  • To reach the programs on one particular unit use sendto(); for every copy of a template in the game, sendtoalldil().

Example

dilbegin dinner_bell();
code
{
:start:
   wait(SFB_CMD, command("pull") and (activator.type == UNIT_ST_PC));
   block;
   act("You pull the rope and the bell rings.", A_ALWAYS, activator, null, null, TO_CHAR);
   act("$1n pulls the rope and the bell rings.", A_ALWAYS, activator, null, null, TO_ROOM);
   send("dinner");
   goto start;
}
dilend

dilbegin hungry_orc();
code
{
:start:
   wait(SFB_MSG, argument == "dinner");
   exec("say Food!", self);
   goto start;
}
dilend

A bell (an object in the room) tells everyone there that dinner is served, and each orc with hungry_orc answers. The orc chief in haon_dor.zon calls his orcs the same way with send("stew").

See also