Script in DX Studio is based on ECMAScript (otherwise known as JavaScript).
Note this is a summary of the scripting language for reference purposes. For help on how to write and use script, please see the online tutorials.
Keywords
function - defines a general function
var - defines a variable
if ... else ... - for conditional blocks
print(...) - writes a string to the player console
do, for, while, switch case, etc. - all standard JavaScript keywords are supported.
Events
Here is a list of the different types of events that can be handled.
Semantics
/* */ blocks or // lines for comments
operators +, -, *, /, !
comparisons ==, !=, <, >, <=, >=
group with brackets ( )
increment, decrement ++, --
Library Functions
Math - a useful library of common mathematical functions
Vector - represents a 1,2 or 3 co-ordinate vector (x,y,z).
Rotation - represents a single axis (x) or quaternion (x,y,z,w) based rotation.
Particle - a very basic object that can be used in particle systems. Can be created with the 'new' keyword.
system - system level functions and variables
objects - object access and properties
sounds - start/stop sounds
keys - contains the state of all keyboard keys
data - database manipulation
textures - access document textures
scenes - access document scenes
layers - access document layers
network - network communications functions
shell - owner application communication
Example - Object Script
/*
example1 - moves the object 10 along the x axis when clicked
*/
function onClick()
{
object.pos.x += 10;
if (object.pos.x>100)
{
object.pos.x -= 100;
}
}


