This wiki is out of date, use the continuation of this wiki instead

Signal

From FenixWiki

(Difference between revisions)
Jump to: navigation, search

Revision as of 15:47, 13 April 2007


Signal() is an in-built function that allows one process to controll another process in a limited number of ways.


Contents

Definition

SIGNAL ( INT processID , INT signal )

or

SIGNAL ( TYPE processName , INT signal )


Returns

...


Parameters

INT processID: The ProcessID of the process to which the signal is to be sent, for a process to send a signal to itself, the local variable id can be used.

TYPE processName: The ProcessName of the process type to which the signal is to be sent, for example, if the signal is to be sent to all Enemy() processes, processName would be "enemy".

INT signal: The code of the signal that is to be sent to the target process, this perameter is passed by way of a set of predefined constants which denote the signal which is to be sent. These are listed below.


Signals

The following signals can be sent from one process to another (these are predefined constants that can be passed as the "signal" parameter):

  • s_kill - Order to kill the process. The process will not appear in the following frames of the game any longer.
  • s_sleep - Order to make the process dormant. The process will remain paralysed, without executing its code and without being displayed on screen (nor being detected by other processes), as if it had been killed. But the porcess will continue to exist in the computer's memory.
  • s_freeze - Order to freeze the process. The process will remain motionless without running its code. But it will continue to be displayed on screen and it will be possible to detect it (in the collisions) by the rest of the processes. The process will continue to exist in the computers memory even if its code is not executed.
  • s_wakeup - Order to wake up the process. It returns a slept or frozen process to its normal state. The process will be executed and displayed again from the moment that it recieves theis signal normally. A process that has been killed cannot be returned to its normal state by this method (or at all).

In addition to these there are the following signals that have the same effect, but affect a range of processes, not just a single process:

These will have the effect of their non-tree counterparts, but will affect the process indicated by the "processID" or "processName" parameter and all of the processes created by those processes, either directly, or indirectly. So if an s_kill_tree signal is sent to a process, that process will die, all of the processes that it created will die, and all of the processes that they created will die, and so on. The exception to this is where there is an orphan process, that is a process to whose father is already dead.


Example

signal( get_id(type enemy) , s_kill ); //kills a process of type enemy
signal( id , s_kill_tree ); //kills the process that calls it, and all of its sons, their sons, etc.
signal( type player , s_freeze ); //freezes all processes of type player so that they are still displayed, but do not execute any code.
Personal tools