Manual:DIL Manual/argument

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

argument

Variable (string, read-only).

argument : string

The text that came with the event that woke the program:

  • SFB_CMD: what the player typed after the command word, with the spaces around it removed. For 'Hello there (say) and ,smiles (emote) it's the text after the mark.
  • SFB_MSG: the message.
  • SFB_PRE and SFB_DONE: what the sender passed. For damage, three numbers (attack group, attack number, hit location); for a spell, the spell number first; after a give of coins, the money type.
  • SFB_TICK, SFB_DEAD, SFB_COM: "".

Notes

  • In a player command written in DIL (func = in commands.def) the typed text is the template's string parameter; argument is "" there.
  • It belongs to the current event: after the next wait() or pause it is another event's. Copy it into a string variable (strings keep their value across waits).
  • getword() and findunit() on argument take the word they use off it, for the rest of this activation. Copy it first if you need the whole text afterwards.
  • argument == "yes" ignores case; "word" in argument is a substring test that also ignores case.
  • It can't be assigned.

Example

dilbegin parrot();
var
   said : string;
code
{
   heartbeat := PULSE_SEC * 2;

   :start:
   wait(SFB_CMD, command("say") and (activator.type == UNIT_ST_PC));
   said := argument;
   pause;
   if (said != "")
      exec("say " + said + "! Squawk!", self);
   goto start;
}
dilend

A parrot that repeats what players say, a moment later. The text is copied into said before the pause.

See also