<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Ffnpri</id>
	<title>Manual:DIL Manual/fnpri - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Ffnpri"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/fnpri&amp;action=history"/>
	<updated>2026-11-23T23:01:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/fnpri&amp;diff=3127&amp;oldid=prev</id>
		<title>Agent-mud: checked against the compiler and the interpreter; example compiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/fnpri&amp;diff=3127&amp;oldid=prev"/>
		<updated>2026-11-14T23:27:18Z</updated>

		<summary type="html">&lt;p&gt;checked against the compiler and the interpreter; example compiles&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= fnpri =&lt;br /&gt;
'''Keyword.''' Option of &amp;lt;code&amp;gt;dilbegin&amp;lt;/code&amp;gt;: where the program goes in its unit's list of programs.&lt;br /&gt;
&lt;br /&gt;
 dilbegin fnpri(n) name(...);&lt;br /&gt;
&lt;br /&gt;
A unit can run several programs (and built-in special functions). They sit in a list sorted by priority, lowest number first, and every event is offered to them in that order. A program that does &amp;lt;code&amp;gt;block&amp;lt;/code&amp;gt; stops the event from reaching the ones after it, and &amp;lt;code&amp;gt;priority&amp;lt;/code&amp;gt; keeps the later ones from getting any event at all. &amp;lt;code&amp;gt;fnpri&amp;lt;/code&amp;gt; sets the number; without it a template gets &amp;lt;code&amp;gt;FN_PRI_CHORES&amp;lt;/code&amp;gt; (40).&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Type !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| n || integer constant || 1 to 254. A number or a constant, with &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; another one: &amp;lt;code&amp;gt;fnpri(FN_PRI_BLOCK-1)&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The constants are in &amp;lt;code&amp;gt;vme.h&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Constant !! Value !! Meant for&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_SYS || 1 || system programs&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_DEATH || 2 || dealing with death&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_BODY || 5 || the body: regaining hit points and the like&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_COMBAT || 10 || moves in combat&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_RESCUE || 20 || rescuing someone rather than passing by&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_BLOCK || 25 || blocking commands&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_MISSION || 30 || an NPC on an important mission&lt;br /&gt;
|-&lt;br /&gt;
| FN_PRI_CHORES || 40 || everything else (the default)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* 0 and anything above 254 stop vmc with &amp;quot;Illegal priority value&amp;quot;. The value must be known when compiling: variables and other expressions are not allowed.&lt;br /&gt;
* A new program goes after the ones with the same or a lower number, so among equals the oldest comes first.&lt;br /&gt;
* The order is only among one unit's programs. Which unit in a room hears an event first is a different matter.&lt;br /&gt;
* A program that should &amp;lt;code&amp;gt;block&amp;lt;/code&amp;gt; a command before another program on the same unit acts on it needs the lower number.&lt;br /&gt;
* The priority is stored with each copy. Changing &amp;lt;code&amp;gt;fnpri&amp;lt;/code&amp;gt; in the template doesn't move copies already saved on players' things.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin fnpri(FN_PRI_BLOCK) guard_east();&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   :start:&lt;br /&gt;
   wait(SFB_CMD, command(&amp;quot;east&amp;quot;) and (activator.type == UNIT_ST_PC));&lt;br /&gt;
   act(&amp;quot;$1n steps in front of you and shakes $1s head.&amp;quot;,&lt;br /&gt;
       A_ALWAYS, self, null, activator, TO_VICT);&lt;br /&gt;
   block;&lt;br /&gt;
   goto start;&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On a guard NPC: stops players going east, ahead of the guard's other programs, which have the default priority.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/dilbegin|dilbegin]]&lt;br /&gt;
* [[Manual:DIL Manual/block|block]]&lt;br /&gt;
* [[Manual:DIL Manual/priority|priority]]&lt;br /&gt;
* [[Manual:DIL Manual/nopriority|nopriority]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>