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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
m
 
Line 2: Line 2:
  
 
<span id="messies"></span>
 
<span id="messies"></span>
  <h3>'''Messages:'''</h3>
+
  <h3>Messages:</h3>
  
 
   In DIL, a program attached to a unit gets activated when the program receives
 
   In DIL, a program attached to a unit gets activated when the program receives

Latest revision as of 14:13, 29 June 2020


Messages:

  In DIL, a program attached to a unit gets activated when the program receives
a message. In order to save CPU usage, there are a number of different message
categories which can cause activation of a program.  The 'wait()' commands first
parameter is an integer, telling what message categories the program should
reactivate on.  The second parameter is an expression, which also must evaluate
to TRUE. 'pause' is just special instances of the 'wait()' command.


Caveat Builder: 
  Whenever you construct the arguments for the wait command, bear in mind that
ALL your tests will be executed EVERYTIME a message of the relevant kind comes
through.  Thus you should keep the length of the activation expression to a
reasonable minimum, and you should NEVER use the time-consuming findxxx-functions.
Valid example (That prohibits a player from removing an object):
:glue:


	wait(SFB_CMD,command(CMD_REMOVE));
	u := findunit(activator,argument,FIND_UNIT_IN_ME,null );
	if (u != self)
	 {
		goto glue;
	 }
	act("You can't remove $2n, it's sticky.",
	   A_SOMEONE,activator,self,null,TO_CHAR););
	block;
	goto glue;
See Also:
Dil and Findunit()
The message categories are as follows:
---~---~---~---~---~---~---~---~---