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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(XML import)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<span id="messies"></span>
 +
<h3>'''Messages:'''</h3>
 +
 +
  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.
 +
 +
 +
<strong>Caveat Builder: </strong>
 +
 +
  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)
 +
act("You can't remove $2n, it's sticky.",
 +
  A_SOMEONE,activator,self,null,TO_CHAR););
 +
block;
 +
goto glue;
  
 +
'''See Also:'''
 +
[[#findunit.html|Dil and Findunit()]]
  
 +
The message categories are as follows:
 +
---~---~---~---~---~---~---~---~---
 
<span id="messies"></span>
 
<span id="messies"></span>
 
  <h3>'''Messages:'''</h3>
 
  <h3>'''Messages:'''</h3>
Line 27: Line 61:
 
  u := findunit(activator,argument,FIND_UNIT_IN_ME,null );
 
  u := findunit(activator,argument,FIND_UNIT_IN_ME,null );
 
  if (u != self)
 
  if (u != self)
{
+
act("You can't remove $2n, it's sticky.",
goto glue;
 
}
 
act("You can't remove $2n, it's sticky.",
 
 
    A_SOMEONE,activator,self,null,TO_CHAR););
 
    A_SOMEONE,activator,self,null,TO_CHAR););
 
  block;
 
  block;

Latest revision as of 22:36, 4 December 2025

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)

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:
---~---~---~---~---~---~---~---~---

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)

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:
---~---~---~---~---~---~---~---~---