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 (edit)
Yonni (Talk | contribs)

← Previous diff
Current revision (11:23, 21 July 2008) (edit) (undo)
Sandman (Talk | contribs)
m
 
(9 intermediate revisions not shown.)
Line 1: Line 1:
[[Category:functions]] [[Category:functions]]
- +[[Category:processinteraction]]
-Signal() is an in-built [[function]] that allows one [[process]] to controll another [[process]] in a limited number of ways.+
- +
== Definition == == Definition ==
 +'''INT''' signal ( <'''INT''' processID|processTypeID> , <'''INT''' signal> )
-SIGNAL ( '''INT''' processID , '''INT''' signal )+Allows a [[process]]/[[function]] or a range of processes/functions of certain [[processType]] to be controlled in a limited number of ways, by sending [[signals]].
- +
-or+
- +
-SIGNAL ( '''TYPE''' processName , '''INT''' signal )+
 +== Parameters ==
 +{|
 +| '''INT''' processID<nowiki>|</nowiki>processTypeID || - The [[ProcessID]] of the process or the [[ProcessTypeID]] of the type of processes to which the signal is to be sent.
 +|-
 +| '''INT''' signal || - The code of the [[signals|signal]] that is to be sent to the target process.
 +|}
== Returns == == Returns ==
 +'''INT''' :
 +{|
 +| [[false]] || - The specified processID<nowiki>|</nowiki>processTypeID was 0 or a [[processTypeID]].
 +|-
 +| [[true]] || - The specified processID<nowiki>|</nowiki>processTypeID was a [[processID]].
 +|}
-...+== Errors ==
 +{|
 +| Invalid processID || - The [[process]] with specified processID is not alive. ''(Pre [[0.90.2]] only)''
 +|-
 +| Invalid signal || - The specified [[signals|signal]] is invalid.
 +|}
 +== Notes ==
 +To obtain the processType of a function, the operator [[Type]] can be used.
 +For a process to send a signal to itself, the [[local variable]] [[id]] can be used.
 +The parameter signal is passed by way of a set of [[signals]] which denote the signal which is to be sent.
-== Parameters ==+To kill all processes at once, except the calling one, use [[let_me_alone]]().
-'''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.+== Example ==
 +<pre>
 +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 descendants
 +signal( Type player , s_freeze ); // Freezes all processes of type player so that they are
 + // still displayed, but do not execute any code.
 +</pre>
-'''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".+{{Funcbox
- + | category = Processinteraction
-'''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 [[frame]]s 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:+
- +
-* [[s_kill_tree]]+
-* [[s_sleep_tree]]+
-* [[s_freeze_tree]]+
-* [[s_wakeup_tree]]+
- +
-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 == +
-<pre>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.</pre>+

Current revision


Contents

[edit] Definition

INT signal ( <INT processID|processTypeID> , <INT signal> )

Allows a process/function or a range of processes/functions of certain processType to be controlled in a limited number of ways, by sending signals.

[edit] Parameters

INT processID|processTypeID - The ProcessID of the process or the ProcessTypeID of the type of processes to which the signal is to be sent.
INT signal - The code of the signal that is to be sent to the target process.

[edit] Returns

INT :

false - The specified processID|processTypeID was 0 or a processTypeID.
true - The specified processID|processTypeID was a processID.

[edit] Errors

Invalid processID - The process with specified processID is not alive. (Pre 0.90.2 only)
Invalid signal - The specified signal is invalid.

[edit] Notes

To obtain the processType of a function, the operator Type can be used. For a process to send a signal to itself, the local variable id can be used. The parameter signal is passed by way of a set of signals which denote the signal which is to be sent.

To kill all processes at once, except the calling one, use let_me_alone().

[edit] 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 descendants
signal( Type player , s_freeze );      // Freezes all processes of type player so that they are
                                       //     still displayed, but do not execute any code.


Processinteraction Functions
Advance() • Collision() • Exists() • Get_angle() • Get_dist() • Get_id() • Let_me_alone() • Signal() • Xadvance() •
Personal tools