Difference between revisions of "Manual:DIL Manual/quit"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="fquit"></span>
+
= quit =
−
quit:
+
'''Procedure.''' Ends the program for good.
−
  This simple command quits the entire DIL program, even if
 
−
  called while inside a procedure or function.
 
  
−
---~---~---~---~---~---~---~---~---
+
  quit;
−
<span id="fquit"></span>
 
−
  quit:
 
−
  This simple command quits the entire DIL program, even if
 
−
  called while inside a procedure or function.
 
  
−
---~---~---~---~---~---~---~---~---
+
The program stops at once and is removed from its unit. It doesn't run again; a new copy only comes with a new unit (a reset) or a <code>dilcopy</code>.
 +
 
 +
== Notes ==
 +
* Inside a procedure or function called as <code>name@zone(...)</code>, <code>quit</code> ends the whole program, the caller included. Use <code>return</code> to leave only the called template.
 +
* Its secures, interrupts and <code>priority</code> end with it.
 +
* A <code>block</code> before <code>quit</code> still blocks the event.
 +
* A program that should run again for the next event goes back to waiting (<code>goto</code> to a label before its <code>wait</code>) instead.
 +
 
 +
== Example ==
 +
<pre>
 +
dilbegin follow_note();
 +
code
 +
{
 +
  if (not self.master)
 +
      quit;
 +
 
 +
  act("You now follow $3n.", A_ALWAYS, self, null, self.master, TO_CHAR);
 +
  quit;
 +
}
 +
dilend
 +
</pre>
 +
Does its one job and ends; with no one to follow it ends at once. Adapted from basemove.zon.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/return()|return()]]
 +
* [[Manual:DIL Manual/goto|goto]]
 +
* [[Manual:DIL Manual/dilcopy()|dilcopy()]]

Latest revision as of 23:23, 14 November 2026

quit

Procedure. Ends the program for good.

quit;

The program stops at once and is removed from its unit. It doesn't run again; a new copy only comes with a new unit (a reset) or a dilcopy.

Notes

  • Inside a procedure or function called as name@zone(...), quit ends the whole program, the caller included. Use return to leave only the called template.
  • Its secures, interrupts and priority end with it.
  • A block before quit still blocks the event.
  • A program that should run again for the next event goes back to waiting (goto to a label before its wait) instead.

Example

dilbegin follow_note();
code
{
   if (not self.master)
      quit;

   act("You now follow $3n.", A_ALWAYS, self, null, self.master, TO_CHAR);
   quit;
}
dilend

Does its one job and ends; with no one to follow it ends at once. Adapted from basemove.zon.

See also