Manual:DIL Manual/prompt

From DikuMUD Wiki
Jump to navigation Jump to search

prompt

Field (string, read/write; units: PC).

pc.prompt : string

The player's prompt template, as set with the prompt command. It can hold codes such as %hp%, %maxhp%, %mana% and %endurance%; the default is "%mana%m/%endurance%e/%hp%h> ". An empty template gives an empty prompt.

The prompt is drawn by send_prompt@update, a DIL program on the player, which reads the template once when it starts. After changing .prompt, restart that program, as the prompt command in commands.zon does.

Notes

  • Players only. On an NPC, an object, a room or null the field fails.
  • Assigning "" or null clears it.
  • A player with a $noprompt extra can't change it with the command.

Example

dilbegin set_prompt(pc : unitptr, s : string);
var
   i : integer;
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   pc.prompt := s;
   i := dildestroy("send_prompt@update", pc);
   dilcopy("send_prompt@update", pc);
   return;
}
dilend

Changes a player's prompt and restarts the program that draws it, as the prompt command does in commands.zon.

See also