Scrigroup - Documente si articole

     

HomeDocumenteUploadResurseAlte limbi doc
AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows
WordXml


Variables - Variable data types

c



+ Font mai mare | - Font mai mic



Variables

Variable data types

There are currently two data types of variables available: an integer type (a value from -2147483648 to 2147483647 inclusively) and a string type. The variable may change its data type during the lifetime: for instance, an integer variable may become of a string type when assigning the string constant and vice versa.



Local Variables

Names of all local variables when addressed in the trigger text are to be preceded by the character @LocalVariableName

Example:

[Trigger]

Set @num = 2

local variable num of the trigger

Halt

Global Variables

Names of all global variables when addressed in the trigger text are to be preceded by the characters @@GlobalVariableName

Example:

[Trigger]

Set @@num = 2

global variable num of the mission

Halt

[Trigger_01]

Set @num_human = @@num

The local variable of the trigger is set to the global variable num

Halt

String Literals

All character strings when addressed in the trigger text are to be enclosed in double quotes "Text String"

Example:

[Trigger]

Set @num = "human"

The local variable num is set to the string "human"

Halt

[Trigger_01]

RunCommand ( GROUP , 'Group_Ger_01' , DEFEND , RECT , 'Rect_03' )

// An example of using string literals in complex triggers

Halt

ARRAY

Represents a sequence of POINT and RECT in a random order.

The path elements can be addressed using their index.

Functions and procedures for working with the path:

ArrayLen( <ArrayName> )

function returning the INT length of path

<ArrayName> - name of the sequence

ArrayGetElementType( <ArrayName>, Num )

function returning the element type using its number:

"NULL" undefined, "POINT" or "RECT";

<ArrayName> - name of the sequence

num - number of the element

ArrayGetElementName( <ArrayName>, Num )

function returning the element name using its number;

<ArrayName> - name of the sequence

num - number of the element

Parameters for Triggers IN and OUT

Parameters for the triggers are implemented using Param IN and Param OUT; the parameters are transferred to the trigger using RunTrigger. and CallTrigger.

The function returning parameters from the trigger is RETURNPARAMS

Example:

[Main]

Set @p1 = "Group1"

Set @p2 = "Group2"

Set @p3 = -1

Set @p4 = -1

RunTrigger("A", @p1, @p2, @p3, @p4)

Or

Set @p1 = "Group1"

Set @p2 = "Group2"

Set @p3 = -1

Set @p4 = -1

RunTriggerInstance("A", @p1, @p2, @p3, @p4)

[A]

Param IN @group_name_1

Param IN @group_name_2

Param OUT @num_tanks

Param OUT @num_human

.trigger's actions.

RETURNPARAMS

.trigger's actions.

The calling of the trigger A results in binding @p1=@group_name_1,@p2=@group_name_2, @p3=@num_tanks, @p4=@num_human.

Trigger A knows its caller

Only local variables can be used as parameters

The section describing the parameters precedes all the trigger operators

The calling trigger can use the very same variables (in particular for IN and for OUT)

When the command RETURNPARAMS is used OUT-parameters of the trigger A (the called one) return their value to the relevant variables of the trigger Main (the calling one)

The triggers Main and A can operate in parallel

When executing RETURNPARAMS, if the calling trigger is absent (i.e. it is over, etc.), an ERROR is written to the log ("ERROR: Trigger 'Main' is inactive") and no actions are performed

The trigger A can be called using: RunTrigger, RunTriggerInstance, CallTrigger, CallTriggerInstance

The called trigger (A) can execute RETURNPARAMS several times. In this case the variables in the calling trigger (Main) are updated. This is convenient for getting periodic updates of various information (units' positions in an attack against several points, complex checks as to the number of units, etc.)



Politica de confidentialitate | Termeni si conditii de utilizare



DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 1028
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved