Manual:DIL Manual/killedit
Jump to navigation
Jump to search
killedit()
Procedure. Takes a player out of the text editor.
killedit(u : unitptr)
Ends the editor that beginedit() started for the player
u, and puts the player back at the normal command prompt. Use it when the player
dies, is attacked or is moved away while writing, as the board scripts in boards.zon do.
If the player is still writing, the editor finishes as if the player had ended it: the
SFB_EDIT event goes out as usual, with the text written so far in
argument.
Parameters
| Name | Type | Meaning |
|---|---|---|
| u | unitptr | The player. |
Notes
- The argument is required:
killedit;without one is a syntax error. - Players only. On an NPC, object or room the zone log gets "Type error in not a pc unit" and the program stops.
- With a null unit nothing happens, apart from a line in the zone log ("killedit with no unit").
- A player who isn't connected (link-dead) is left as they are.
- It ends any editor the player is in, also one started by a command such as
describe, which then keeps what was written.
Example
dilbegin write_note(fn : string);
var
err : integer;
code
{
interrupt(SFB_DEAD, activator == self, stop);
interrupt(SFB_COM, activator == self, stop);
sendtext("Write your note.<br/>", self);
beginedit(self);
wait(SFB_EDIT, activator == self);
if (argument != "")
{
err := savestr(fn, argument, "w");
sendtext("Note saved.<br/>", self);
}
quit;
:stop:
killedit(self);
sendtext("You stop writing.<br/>", self);
quit;
}
dilend
Lets a player write a note to a file, and takes the player out of the editor when attacked or killed, as the reply code in boards.zon does.