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

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="bpnopri"></span>
+
= nopriority =
−
nopriority
+
'''Procedure.''' Ends the <code>priority</code> set by this program.
−
    result: Cancels the priority procedure.
 
  
−
---~---~---~---~---~---~---~---~---
+
  nopriority;
−
<span id="bpnopri"></span>
 
−
  nopriority
 
−
    result: Cancels the priority procedure.
 
  
−
---~---~---~---~---~---~---~---~---
+
After <code>nopriority</code>, the unit's other programs get events again. When no priority is set it does nothing, so a program can call it at the top of its loop every time.
 +
 
 +
== Notes ==
 +
* Call it before going back to waiting. A program that waits under <code>priority</code> keeps the unit's later programs dead while it waits.
 +
* Ending the program ends the priority too; no <code>nopriority</code> is needed before <code>quit</code>.
 +
 
 +
== Example ==
 +
<pre>
 +
dilbegin fnpri(FN_PRI_MISSION) john_assist();
 +
external
 +
  integer walk_room@function(s : string, i : integer);
 +
var
 +
  tf : integer;
 +
  s : string;
 +
code
 +
{
 +
  heartbeat := PULSE_SEC * 3;
 +
  on_activation(self.position <= POSITION_SLEEPING, skip);
 +
 
 +
  :start:
 +
  nopriority;
 +
  wait(SFB_MSG, activator.nameidx == "mary");
 +
  priority;
 +
  s := argument;
 +
  tf := walk_room@function("cabin@haon_dor", 4);
 +
  exec("kill " + s, self);
 +
  pause;
 +
  exec("emote screams, 'Murderer, " + s + "!'", self);
 +
  goto start;
 +
}
 +
dilend
 +
</pre>
 +
John runs home to help his wife, with his random walking held back by <code>priority</code> until he goes back to waiting. From haon_dor.zon.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/priority|priority]]
 +
* [[Manual:DIL Manual/fnpri|fnpri]]

Latest revision as of 23:23, 14 November 2026

nopriority

Procedure. Ends the priority set by this program.

nopriority;

After nopriority, the unit's other programs get events again. When no priority is set it does nothing, so a program can call it at the top of its loop every time.

Notes

  • Call it before going back to waiting. A program that waits under priority keeps the unit's later programs dead while it waits.
  • Ending the program ends the priority too; no nopriority is needed before quit.

Example

dilbegin fnpri(FN_PRI_MISSION) john_assist();
external
   integer walk_room@function(s : string, i : integer);
var
   tf : integer;
   s : string;
code
{
   heartbeat := PULSE_SEC * 3;
   on_activation(self.position <= POSITION_SLEEPING, skip);

   :start:
   nopriority;
   wait(SFB_MSG, activator.nameidx == "mary");
   priority;
   s := argument;
   tf := walk_room@function("cabin@haon_dor", 4);
   exec("kill " + s, self);
   pause;
   exec("emote screams, 'Murderer, " + s + "!'", self);
   goto start;
}
dilend

John runs home to help his wife, with his random walking held back by priority until he goes back to waiting. From haon_dor.zon.

See also