Manual:DIL Manual/argument
Jump to navigation
Jump to search
Contents
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
giveof 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;argumentis""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
argumenttake 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 argumentis 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.