Skip to content

Manual:DIL Manual destroy()

iamnove edited this page Jan 18, 2023 · 57 revisions


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
---~---~---~---~---~---~---~---~---


---~---~---~---~---~---~---~---~---
Clone this wiki locally