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

ProcessID

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 23:24, 24 March 2007 (edit)
86.136.103.186 (Talk)

← Previous diff
Revision as of 23:17, 25 March 2007 (edit) (undo)
Sandman (Talk | contribs)
(Some typo's and shit. Replaced the get_id() by an actual initialization of a process, because Type is about ProcessTypeID.)
Next diff →
Line 1: Line 1:
- +== Definition ==
-== Defenition ==+
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.+This makes it possible to use for example the [[function]] [[collision]]() in an [[if]]() statement. This is because [[collision]]() [[return|returns]] the ProcessID the [[process]] calling [[collision]]() has collided with.
-== Useage ==+== Usage ==
-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:+ProcessID is used when referring to specific [[process]] (an instance of a [[processtype]]) and access/edit its [[local]] [[variables]]. The ProcessID of a [[process]] is found by on of the following methods:
-*Returned when the [[frame]] statement is found in the process.+*[[return|Returned]] when the [[frame]]; statement is found in the process.
-*Returned by the [[get_id]]() function.+*[[return|Returned]] by the [[get_id]]() function.
-*Returned by the [[collision]]() function.+*[[return|Returned]] by the [[collision]]() function.
-*Stored as the local variable [[id]] (holds the value of the process' own ProcessID).+*[[store|Stored]] as the [[local]] [[variable]] [[id]] (holds the [[process]]' own ProcessID).
-*Stored as the local variable [[father]] (holds the value of the ProcessID of the process that called the current process).+*[[store|Stored]] as the [[local]] [[variable]] [[father]] (holds the ProcessID of the [[process]] that [[call|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).+*[[store|Stored]] as the [[local]] [[variable]] [[son]] (holds the ProcessID of the [[process]] last [[call|called]] from the current [[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).+*[[store|Stored]] as the [[local]] [[variable]] [[bigbro]] (holds the ProcessID of the [[process]] [[call|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).+*[[store|Stored]] as the [[local]] [[variable]] [[smallbro]] (holds the ProcessID of the [[process]] [[call|called]] by the [[father]] immediately after the current [[process]]).
<br /> <br />
-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.+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]].
== Example == == Example ==
<pre> <pre>
-private+Private
-ball;+ int ballID;
- ballx;+ int ballx;
- bally;+ int bally;
-begin+Begin
- ball = get_id(type ballprocess);+ ballID = BallProcess();
- ballx = ball.x;+ ballx = ball.x;
- bally = ball.y;+ bally = ball.y;
-end+End
 +Process BallProcess( )
 +Begin
 + Loop
 + frame;
 + 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> <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.+Note that [[function|functions]] do NOT have a ProcessID, as a ProcessID is assigned when the [[frame]]; statement is reached in the code, making it a [[process]].
- +
- +
-----+
- +
---[[User:Sandman|Sandman]] 14:56, 23 March 2007 (CET)+

Revision as of 23:17, 25 March 2007

Definition

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.

Usage

ProcessID is used when referring to specific process (an instance of a processtype) and access/edit its local variables. The ProcessID of a process is found by on of the following methods:


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.

Example

Private
    int ballID;
    int ballx;
    int bally;
Begin
    ballID = BallProcess();
    ballx = ball.x;
    bally = ball.y;
End
Process BallProcess( )
Begin
    Loop
        frame;
    End
End


This demonstrates using the period (".") character between the ProcessID and the variable name to access a local variable.

Note that functions do NOT have a ProcessID, as a ProcessID is assigned when the frame; statement is reached in the code, making it a process.

Personal tools