VRGrid Scripting

Just as javascript extends the functionality of HTML web pages from static content to dynamic content, VRGrid as its internal scripting engine seo lets take a look at its reference.

The <define> tag .Defines script variables and functions. The <define> tag can be contained by <body> and <create> tags. Variable name, attributes, and values follows this format:

<define>
<variablename>variablevalue</variablename>
<!-- or -->
<variablename attribute="value" />
</define>

The <function> tag. Defines a named script function. Contained by <define> tags.

<function name="functionname">
... function definition ...
</function>
 

The <script> tag. Call functions and perform other scripting operations.

<script trigger="(delay|proximity|roll on|roll off|
click on|step in|step out|proximity|timer|location|
key down|key hold|key up)" delay="seconds"
radius="number_of_units" key="keyvalue">
... script ...
</script>

Comments
// text following double slashes is ignored to end of line
/* text between slash-asterix is ignored,
even on multiple lines */
------
Syntax
A single statement may be spread over multiple lines. All statements must end in a semi-colon.
------
Operators
Mathematical
Addition
x + y
Subtraction
x - y
Multiplication
x * y
Division
x / y
Modulus
x % y
Assignment
x = y
------
Comparison
Equality
x = y
Inequality
x != y
Greater Than
x gt y
Greater Than or Equal To
x ge y
Less Than
x lt y
Less Than or Equal To
x le y
------
Logical
AND
x and y
OR
x or y
NOT (negation)
not x
------
String Concatenation
myString = "My" # "String"
------
Statements
Compound
{
do this;
do that;
}

If-Else
if ( expression )
{ do this }
else
{ do that }

Switch-Case
switch (x)
{
case y { do this }
case z { do that }
default { do default }
}

While-Do loop
while ( expression ) { do this }

Do-While loop
do { do this } while ( expression )

For loop
for loopvar = startval to endval { do this }
<!-- or -->
for loopvar = startval to endval step stepval { do this }

For-Each loop
for each item in collection { do this with item }