Manual:DIL Manual/unsecure()

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

unsecure()

Procedure. Ends the secure on a unit.

unsecure(u : unitptr)

Ends what secure() started: the program no longer jumps to the label when u leaves, and from the next wake on the variables holding u are cleared like any other unit variable.

Parameters

Name Type Meaning
u unitptr The secured unit.

Notes

  • Call it before destroy() on a secured unit: destroying it fires the secure, the program jumps to the label at once and the rest is skipped.
  • It only ends the secures made in the current template call. A unit the caller secured stays secured.
  • Nothing happens when the unit isn't secured or the variable is null.

Example

dilbegin token_taker();
var
   item : unitptr;
code
{
   heartbeat := PULSE_SEC * 3;
:start:
   wait(SFB_DONE, command("give") and (target == self));
   item := medium;
   secure(item, gone);
   pause;
   act("$1n looks closely at $2n and nods.", A_ALWAYS, self, item, null, TO_ROOM);
   unsecure(item);
   destroy(item);
   goto start;

:gone:
   goto start;
}
dilend

An NPC takes what it is given, looks at it, and destroys it. Without the unsecure(), destroy() would jump to gone, which here happens to be harmless, but skips anything written after it.

See also