Manual:DIL Manual/destroy()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 13:08, 27 May 2020 by Nove (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Function:  destroy ( u : unitptr );
  u
         :Unit to remove from game
The destroy function works in two ways depending on the Unit being acted on.
If the Unit being acted on is a PC the player is saved and ejected from the game.
If the Unit being acted on is a NPC, or an Object. the purge function destroys
the Unit.  Currently destroy will not destroy rooms.
This is different from the old destroy function in that it removes the player
out of the game instead of leaving the player in the menu.
Example

---~---~---~---~---~---~---~---~---
dilbegin purge_all_pc();
var
        u:unitptr/*Unit used to purge each player*/
        n:unitptr;/*used to keep track of next player*/
code
{
u:=ghead();/*get first pc in game list*/
n:=u;


while (n.type==UNIT_ST_PC)/*while unit is a pc*/
        {
        n:=u.gnext;
        destroy(u);
        }
quit;/*done whiping out the players*/
}
dilend
---~---~---~---~---~---~---~---~---


---~---~---~---~---~---~---~---~---