Manual:DIL Manual/excmdstr case

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

excmdstr_case

Variable (string, read-only).

excmdstr_case : string

The first word of the line the player typed, exactly as typed: Mellon stays "Mellon". Otherwise the same as excmdstr: ' gives "say", , gives "emote", and it is null outside a typed command.

Notes

  • Use it where case matters, such as a password typed at a prompt: commands.zon's password command reads it after wait(SFB_CMD, self == activator) and block.
  • == on strings ignores case, so excmdstr_case == "Mellon" is also true for mellon. For an exact match use strcmp(excmdstr_case, "Mellon") == 0.
  • Only the first word: the rest of the line is in argument, which keeps its case.
  • Like excmdstr it belongs to the command: an exec() of the same command while handling it leaves it null. Copy it first.

Example

dilbegin secret_word();
var
   word : string;
code
{
   sendtext("Speak the word, exactly as it is written: ", self);
   wait(SFB_CMD, activator == self);
   block;
   word := excmdstr_case;
   if (strcmp(word, "Mellon") == 0)
      sendtext("The doors swing open.<br/>", self);
   else
      sendtext("Nothing happens.<br/>", self);
   quit;
}
dilend

Asks the player for a word and accepts only Mellon with that capital letter. The block keeps the word from running as a command.

See also