system.script.<...>

Return to Introduction  Previous page  Next page

Gets or sets a document level script variable, or calls a document script function.

 

Syntax

 

system.script.<variable name>

system.script.<function name>(<function params>)

 

Examples

 

In document script...

 

var mycounter=0; // declares a variable 'mycounter'.

 

function testFunc() // a test function

{

       print("testing...");

}

 

 

In script on an object in a scene...

 

function onInit()

{

       system.script.mycounter=0; // set the system variable 'mycounter' to 0.

}

 

function onClick()

{

       system.script.mycounter++;  // increment the system variable 'mycounter'.

       system.script.testFunc();   // calls the test function

}

 

function onUpdate()

{

       if (system.script.mycounter>0)

       {

               // do something if the system variable 'mycounter' is greater than 0.

       }

}

 

Remarks

 

System wide variables need to be declared in the document level script, outside of any function.  They can then be accessed from any script using the above notation.

 

See Also

 

System



Copyright ©2004 Worldweaver Ltd. DX Studio Home