<< Click to Display Table of Contents >> Navigation: 3. Script Language > Variable Definitions and Operations > Variable Commands |
MiniRobotLanguage (MRL)
VAI. Command
VAriable Indirekt
Intention
This command can be used to assign a Value to a Variable which Name is stored inside another Variable.
The purpose of this command is to be able, to tell a Subprogramm that is called with GSB. or JNF. etc.
where to put the result of the Operation. Also it can be used to emulate Arrays of Variables from 0 to 99.
For example $$H00 to $$H99.
Here is an example.
' Variable gets the Name of another Variable.
' Always use VAB. for that!
VAB.$$OUT=$$INA
' Now here comes VAI.
VAI.$$OUT=1232
' Look what we got.
MBX.$$INA
' This Sample shows what its really good for.
VAB.$$INB=$$INC
GSB.CommandX|$$INB
MBX.$$INC
GSB.CommandX|$$IND
MBX.$$IND
ENR.
'===========================================================
:CommandX
VAO.$$TXT=§§_01
DBP.$$TXT
VAI.$$TXT=123
RET.
Here is another example that shows how you can write to Variables $$H01 to $$H99 in a loop using VAI.
FOR.$$LOP|1|99
VAN.$$CNT=$$LOP
FMT.$$CNT|00
VAR.$$HLT=$$H$$CNT
VAI.$$HLT=$$LOP
NEX.
Syntax
VAI.P1=P2
Parameter Explanation
P1 - Variable-name of a Variable that contains the name of another Variable.
P2 - Value that will be assigned to the variable that is inside the P1-Variable. If P2 is omitted,
the variable will be set to empty.
Example
'**********************************
' VAI.
'**********************************
' This Sample shows what its really good for.
VAB.$$INB=$$INC
GSB.CommandX|$$INB
MBX.$$INC
' $$IND was not defined before
GSB.CommandX|$$IND
MBX.$$IND
ENR.
'===========================================================
:CommandX
' Important to use VAO. here!
VAO.$$TXT=§§_01
DBP.$$TXT
' Here comes VAI.
VAI.$$TXT=123
RET.
Remarks
Use VAI. together with VAB. and VAO.
Limitations:
-
See also:
• VBA. - Variable Binary Append
• VAR. - Variable Set Value/Clear
• VAV. - Variables with Variables
• CAL. - mathematical CALculation