- This wiki is out of date, use the continuation of this wiki instead
ProcessID
From FenixWiki
Revision as of 23:19, 24 March 2007 (edit) 86.136.103.186 (Talk) (Added all but the basic definition of the value and how it can be used in an if statement.) ← Previous diff |
Revision as of 23:22, 24 March 2007 (edit) (undo) 86.136.103.186 (Talk) Next diff → |
||
Line 1: | Line 1: | ||
A ProcessID is a unique identification code, for one instance of a [[processtype]]. A ProcessID is always odd and larger than 65536 (2^16).<br /> | A ProcessID is a unique identification code, for one instance of a [[processtype]]. A ProcessID is always odd and larger than 65536 (2^16).<br /> | ||
- | + | This makes it possible to use for example the [[function]] [[collision]]() in an [[if]]() statement. This is because [[collision]]() returns the ProcessID the [[process]] calling [[collision]]() has collided with. | |
+ | <p> | ||
+ | ProcessID is used when needing to referece to a specific process and access/edit it's local variables. The ProcessID of a function is found by on of the following methods: | ||
*Returned when the [[frame]] statement is found in the process. | *Returned when the [[frame]] statement is found in the process. | ||
*Returned by the [[get_id]]() function. | *Returned by the [[get_id]]() function. | ||
Line 13: | Line 15: | ||
<pre> | <pre> | ||
private | private | ||
- | + | ball; | |
- | + | ballx; | |
- | + | bally; | |
begin | begin | ||
- | + | ball = get_id(type ballprocess); | |
- | + | ballx = ball.x; | |
- | + | bally = ball.y; | |
end | end | ||
</pre> | </pre> | ||
<br /> | <br /> | ||
This demonstrates using the period (".") character between the ProcessID and the variable name to access a local variable. | This demonstrates using the period (".") character between the ProcessID and the variable name to access a local variable. | ||
- | <p> | ||
- | This makes it possible to use for example the [[function]] [[collision]]() in an [[if]]() statement. This is because [[collision]]() returns the ProcessID the [[process]] calling [[collision]]() has collided with. | ||
<p> | <p> | ||
Please note that [[function]]s do NOT have a ProcessID as the ProcessID is assigned when the [[frame]] statement is used in the process. | Please note that [[function]]s do NOT have a ProcessID as the ProcessID is assigned when the [[frame]] statement is used in the process. |
Revision as of 23:22, 24 March 2007
A ProcessID is a unique identification code, for one instance of a processtype. A ProcessID is always odd and larger than 65536 (2^16).
This makes it possible to use for example the function collision() in an if() statement. This is because collision() returns the ProcessID the process calling collision() has collided with.
ProcessID is used when needing to referece to a specific process and access/edit it's local variables. The ProcessID of a function is found by on of the following methods:
- Returned when the frame statement is found in the process.
- Returned by the get_id() function.
- Returned by the collision() function.
- Stored as the local variable id (holds the value of the process' own ProcessID).
- Stored as the local variable father (holds the value of the ProcessID of the process that called the current process).
- Stored as the local variable son (holds the value of the ProcessID of the process last called from the curren process).
- Stored as the local variable bigbro (holds the value of the ProcessID of the process called by the father immediately before the current process).
- Stored as the local variable smallbro (holds the value of the ProcessID of the process called by the father immediately after the current process was called).
The ProcessID can either be used as an argument for a fuction such as get_angle() or get_dist() or as a way of using the local variable of another process. For example, to use the x and y local variables of a process:
private ball; ballx; bally; begin ball = get_id(type ballprocess); ballx = ball.x; bally = ball.y; end
This demonstrates using the period (".") character between the ProcessID and the variable name to access a local variable.
<p>
Please note that functions do NOT have a ProcessID as the ProcessID is assigned when the frame statement is used in the process.
--Sandman 14:56, 23 March 2007 (CET)