Difference between revisions of "Manual:DIL Manual/destroy()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(XML import)
 
Line 1: Line 1:
 
 
 
<span id="bpdest"></span>
 
<span id="bpdest"></span>
  
Line 23: Line 21:
 
         n:unitptr;/*used to keep track of next player*/
 
         n:unitptr;/*used to keep track of next player*/
 
  code
 
  code
  {
+
dilend
  u:=ghead();/*get first pc in game list*/
+
 
  n:=u;
+
  ---~---~---~---~---~---~---~---~---
 +
 
 +
  </i><!--ENDCODE-->
 +
 
 +
 
 +
  ---~---~---~---~---~---~---~---~---
 +
<span id="bpdest"></span>
  
 +
'''Function:'''  <i><!--CODE-->destroy ( u : unitptr );</i><!--ENDCODE-->
  
  while (n.type==UNIT_ST_PC)/*while unit is a pc*/
+
  <!--TERM-->  '''u'''
        {
+
<!--DEFINITION-->        :Unit to remove from game
        n:=u.gnext;
 
        destroy(u);
 
        }
 
  
  quit;/*done whiping out the players*/
+
  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.
dilend
+
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'''
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
dilbegin purge_all_pc();
 +
var
 +
        u:unitptr/*Unit used to purge each player*/
 +
        n:unitptr;/*used to keep track of next player*/
 +
  code
 +
dilend
  
 
  ---~---~---~---~---~---~---~---~---
 
  ---~---~---~---~---~---~---~---~---

Latest revision as of 22:36, 4 December 2025

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

dilend

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


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

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

dilend

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


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