Skip to content

Latest commit

 

History

History
1378 lines (1289 loc) · 96 KB

README-MiniScript.md

File metadata and controls

1378 lines (1289 loc) · 96 KB

LOGO

This is the documentation of MiniScript language. This document is WIP.

1. Introduction

Introduction to MiniScript language features:

  • very small implementation of a scripting language
  • runs on every CPU, OS, ... due to its simplicity, so its highly portable just like TDME2 is
  • can be easily extended by writing state machine machine states and script methods in C++
  • works with the following data types: boolean, integer, float, string, vector2, vector3, vector4, quaternion, matrix3x3, matrix4x4, transform, array, map and set
  • when calling script methods/returning from methods it does not use references or pointers but only value by copy
  • supports user script functions and recursion
  • supports kind of references by optionally assigning back argument values to variables
  • supports operators by operator to method mapping by a preprocessor run
  • supports loops and conditions
  • supports event like programming
  • can be transpiled to C++

2. Flow control

2.1. If, elseif, else and end

If, elseif, else and end are flow control methods. Please see the usage below.

See an example of if and end:

...
	$i = 1
	if ($i == 1)
		console.log("i -> 1")
	end
...

See an example of if and else and end:

...
	$i = 2
	if ($i == 1)
		console.log("i -> 1")
	else
		console.log("else: ", $i)
	end
...

See an example of if, elseif, else and end:

...
	$i = 2
	console.log($i, ":")
	if ($i == 0)
		console.log("i -> 0")
	elseif ($i == 1)
		console.log("i -> 1")
	elseif ($i == 2)
		console.log("i -> 2")
	elseif ($i == 3)
		console.log("i -> 3")
	else
		console.log("else: ", $i)
	end
...

2.2. forTime, forCondition

forTime and forCondition are loops and belong to flow control also:

forTime takes a single argument "time" - it repeats the loop until "time" in milliseconds has passed since the initialization of the loop. See an example of forTime() below:

...
	$i = 0
	forTime(2000)
		console.log($i, ": Hello World")
		script.wait(500)
		++$i
	end
...

forCondition takes a single boolean value as argument. The loop will be executed as long as the argument is true. In this case "$i < 5" translates to "lesser($i, 5)" which results in a boolean value, which is used as the forCondition argument. See example of forCondition() below.

...
	$i = 0
	forCondition($i < 5)
		console.log("$ = ", $i)
		++$i
	end
...

3. Functions

See this example that shows user script functions and recursion.

It also shows $arguments array variable, which is created in function context and allows access to all arguments that the function was called with. Argument variable names in function declaration are also populated in function context with corresponding values.

...
# user script function of recursive factorial computation
function: factorial($value)
	console.log("factorial(): $arguments = " + $arguments + " / $value = " + $value)
	if ($value == 0) 
		return(1)
	end
	return($value * factorial($value - 1))
end
...
	console.log("factorial(5) = " + factorial(5))
...

If a argument variable is prefixed with a = operator in function declaration, this variable will be assigned back after the function returns. See =$b and =$c.

...
# user script function to test assign back in user functions
function: assignTest($a, =$b, =$c)
	$a = "a"
	$b = "b"
	$c = "c"
end
...
	$a = "0"
	$b = "1"
	$c = "2"
	console.log("assignTest(): pre: $a = " + $a + ", $b = " + $b + ", $c = " + $c)
	assignTest($a, $b, $c)
	console.log("assignTest(): post: $a = " + $a + ", $b = " + $b + ", $c = " + $c)
...

Global variables can always be accessed by using the "$GLOBAL." accessor. By default variables are read from current context and if they have not been found from root context. So to be sure to use a global variable in function scope, just use the "$GLOBAL." accessor.

...
# user script function to test global variable access
function: globalVariableTest()
	console.log("globalVariableTest(): $GLOBAL.globalTest = " + $GLOBAL.globalTest)
	$GLOBAL.globalTest = "Been there, done that, got the t-shirt"
end
...
	$globalTest = "Global Test Variable"
	console.log("globalVariableTest(): pre: $globalTest = " + $globalTest)
	globalVariableTest()
	console.log("globalVariableTest(): post: $globalTest = " + $globalTest)
...

4. Data types and variables

MiniScript works with the following data types:

  • boolean
  • integer
  • float
  • string
  • vector2
  • vector3
  • vector4
  • quaternion
  • matrix3x3
  • matrix4x4
  • transform
  • array
  • map
  • set

Variable identifiers always start with a "$", not because we love money and/or PHP, but because its the cheapest way to determine if e.g. a argument is a literal or a variable. Constants need also be prefixed with a "$" and should be named with uppercase letters like "$PI = 3.14". (No real constant support yet, but it is planned)

4.1. Primitive data types

The following primitive data types are available: boolean, integer, float, string.

Variables of those types can be assigned implicitly, which means the parser know about the data type by given value:

...
	$boolean = true
	$boolean = false
...
...
	$integer = 123
...
...
	$float = 456.789
...
...
	$string = "This is my mighty string"
...

The primitive data types can also be assigned by using initialization methods that return explicitly those primitive data types:

...
	$boolean = bool(true)
	$boolean = bool(false)
...
...
	$integer = int(123)
...
...
	$float = float(456.789)
...
...
	$string = string("This is my mighty string")
...

4.2. Compound math data types

MiniScript works with the following math specific data types:

  • vector2
  • vector3
  • vector4
  • quaternion
  • matrix3x3
  • matrix4x4
  • transform

Those variables can be created the following ways:

...
	$vector2 = vec2(-1.0, 1.0)
...
...
	$vector3 = vec3(-1.0, 1.0, -2.0)
...
...
	$vector4 = vec4(-1.0, 1.0, -2.0, 1.0)
...
...
	$quaternion = quaternion.identity()
...
...
	$matrix3 = mat3.identity()
...
...
	$matrix4 = mat4.identity()
...
...
	$translation = vec3(-1.0, 1.0, -2.0)
	$scale = vec3(2.0, 2.0, 2.0)
	$rotationZ = 0.0
	$rotationY = 90.0
	$rotationX = 0.0
	$transform = transform($translation, $scale, $rotationZ, $rotationY, $rotationX)
	# or
	$transform = transform(vec3(-1.0, 1.0, -2.0), vec3(2.0, 2.0, 2.0), 0.0, 90.0, 0.0)
...

For more math related methods just look into "6. Methods" section.

4.3. Arrays

An array is a collection/sequence of values which can be accessed by indices.

Initializing an array:

...
	$array = array()
...

... or initialize and push values to it:

...
	$array = array(1, 2, 3)
...

Pushing values using array.push():

...
	array.push($array, 5, 6, 7)
...

Pushing values using [] operator:

...
	$array[] = 8
	$array[] = 9
	$array[] = 10
...

Iterating arrays using array.length() and array.get():

...
	$i = 0
	forCondition($i < array.length($array))
		console.log($i + ": " + array.get($array, $i))
		++$i
	end
...

Iterating arrays using array.length() and [] operator:

...
	$i = 0
	forCondition($i < array.length($array))
		console.log($i + ": " + $array[$i])
		++$i
	end
...

Removing values from arrays using array.removeOf():

...
	array.removeOf($array, 6)
	array.removeOf($array, 7)
...

Removing from arrays using a index with array.remove():

...
	array.remove($array, 2)
...

4.4. Maps

A map is key, value pair storage using a underlying hash map. Keys can only exist once in a map.

Initializing maps using map() method:

...
	$map = map()
...

Setting map key, value pairs using map.set():

...
	map.set($map, "test1", 123)
	map.set($map, "test2", 456)
	map.set($map, "test3", array(1, 2, 3))
	map.set($map, "test4", "Yaaaa")
...

Removing from map using map.remove() and a given key:

...
	map.remove($map, "test2")
...

Reading values from map using map.get() and given keys:

...
	console.log("map value for test1 key using map.get(): ", map.get($map, "test1"))
	console.log("map value for test2 key using map.get(): ", map.get($map, "test2"))
	console.log("map value for test3 key using map.get(): ", map.get($map, "test3"))
	console.log("map value for test4 key using map.get(): ", map.get($map, "test4"))
...

Reading values from map using dot operator:

...
	console.log("map value for test1 using map dot operator: ", $map.test1)
	console.log("map value for test2 using map dot operator: ", $map.test2)
	console.log("map value for test3 using map dot operator: ", $map.test3)
	console.log("map value for test4 using map dot operator: ", $map.test4)
...

Setting key, value pairs to map using dot operator:

...
	$map.test6 = 666
	$map.test7 = 770
...

Reading map keys:

...
	console.log("map keys: ", map.getKeys($map))
...

Reading map values:

...
	console.log("map values: ", map.getValues($map))
...

Reading all keys and values from map using map.get() and map.getKeys()

...
	$mapKeys = map.getKeys($map)
	$i = 0
	forCondition($i < array.length($mapKeys))
		console.log($mapKeys[$i] + " = " + map.get($map, $mapKeys[$i]))
		++$i
	end
...

4.5. Sets

A set is value storage using a underlying hash set. Keys can only exist once in a set.

Initializing sets using set() method:

...
	$set = set()
...

Inserting keys into set using set.insert():

...
	set.insert($set, "test1")
	set.insert($set, "test2")
	set.insert($set, "test3")
...

Removing keys from set using set.remove():

...
	set.remove($set, "test2")
...

Checking if keys exist in map using map.has() and given keys:

...
	console.log("set does have test1 key using set.has(): ", set.has($set, "test1"))
	console.log("set does have test2 key using set.has(): ", set.has($set, "test2"))
	console.log("set does have test3 key using set.has(): ", set.has($set, "test3"))
	console.log("set does have test4 key using set.has(): ", set.has($set, "test4"))
	console.log("set does have test5 key using set.has(): ", set.has($set, "test5"))
...

Checking if keys exist in map using dot opertator and given keys:

...
	console.log("set key for test1 using set dot operator: ", $set.test1)
	console.log("set key for test2 using set dot operator: ", $set.test2)
	console.log("set key for test3 using set dot operator: ", $set.test3)
	console.log("set key for test4 using set dot operator: ", $set.test4)
	console.log("set key for test5 using set dot operator: ", $set.test5)
...

Inserting/Removing set keys by using dot operator and boolean assignment:

...
	$set.test6 = true
	$set.test7 = true
	$set.test8 = false
	$set.test9 = true
...

Reading all keys as array from set:

...
	console.log("set keys: ", set.getKeys($set))
...

5. Program structure and flow

... TODO ...

6. MiniScript methods

Methods
Get Variable
getVariable($variable: String): Mixed
Set Variable
setVariable($variable: String, $value: Mixed): Mixed
Unset Variable
unsetVariable($variable: String): Void
Add
add($a: Mixed, $b: Mixed): Mixed
Logical And
and($a: Boolean, $b: Boolean): Boolean
Create Array
array(...): Array
Get Array Entry
array.get($array: Array, $index: Integer): Mixed
Set Array Entry
array.set(=$array: Array, $index: Integer, ...): Void
Get Array Index by Value
array.indexOf($array: Array, $value: String[, $beginIndex: Integer, ...]): Integer
Get Array Length
array.length($array: Array): Integer
Add to Array
array.push(=$array: Array, ...): Void
Remove Array by Index
array.remove(=$array: Array, $index: Integer): Void
Remove Array Entry by Value
array.removeOf(=$array: Array, $value: String[, $beginIndex: Integer]): Void
Reverse Array
array.reverse(=$array: Array): Void
Sort Array
array.sort(=$array: Array, $function: String): Void
Bitwise And
bitwiseAnd($a: Integer, $b: Integer): Integer
Bitwise Not
bitwiseNot($value: Integer): Integer
Bitwise Or
bitwiseOr($a: Integer, $b: Integer): Integer
Bitwise Xor
bitwiseXor($a: Integer, $b: Integer): Integer
Create Bool
bool($bool: Boolean): Boolean
Print to Console
console.log(...): Void
Divide
div($a: Mixed, $b: Mixed): Mixed
Else
else(): Void
Else If
elseif($condition: Boolean): Void
End
end(): Void
Equals
equals($a: Mixed, $b: Mixed): Boolean
Create Float
float($float: Float): Float
For Condition
forCondition($condition: Boolean): Void
For Time
forTime($time: Integer): Void
Greater
greater($a: Mixed, $b: Mixed): Boolean
Greater Equals
greaterEquals($a: Mixed, $b: Mixed): Boolean
If
if($condition: Boolean): Void
Create Integer
int($int: Integer): Integer
Deserialize JSON
json.deserialize($json: String): Mixed
Serialize JSON
json.serialize($value: Mixed): String
Lesser
lesser($a: Mixed, $b: Mixed): Boolean
Lesser Equals
lesserEquals($a: Mixed, $b: Mixed): Boolean
Create Map
map(): Map
Has Entry by Key
map.has($map: Map, $key: String): Boolean
Get Map Value by Key
map.get($map: Map, $key: String): Mixed
Set Map Entry
map.set(=$map: Map, $key: String, ...): Void
Get Map Keys
map.getKeys($map: Map): Array
Get Map Values
map.getValues($map: Map): Array
Remove Map Entry
map.remove(=$map: Map, $key: String): Void
Create Identity 3x3 Matrix
mat3.identity(): Matrix3x3
Multiply 3x3 Matrix with 3x3 Matrix or Vector2
mat3.multiply($mat3: Matrix3x3, ...): Mixed
Create Rotation 3x3 Matrix
mat3.rotate($angle: Float): Matrix3x3
Create 3x3 Matrix which rotates around Point
mat3.rotateAroundPoint($point: Vector2, $angle: Float): Matrix3x3
Create 3x3 Matrix which rotates around Texture Center
mat3.rotateAroundTextureCenter($angle: Float): Matrix3x3
Create Scale 3x3 Matrix
mat3.scale(...): Matrix3x3
Create Translation 3x3 Matrix
mat3.translate($translation: Vector2): Matrix3x3
Compute Euler Angles from 4x4 Matrix
mat4.computeEulerAngles($mat4: Matrix4x4): Vector3
Create Identity 4x4 Matrix
mat4.identity(): Matrix4x4
Create 4x4 Matrix Inverse
mat4.invert($mat4: Matrix4x4): Matrix4x4
Multiply 4x4 Matrix with 4x4 Matrix or Vector3 or Vector4
mat4.multiply($mat4: Matrix4x4, ...): Mixed
Create Rotation 4x4 Matrix
mat4.rotate($axis: Vector3, $angle: Float): Matrix4x4
Create Scale 4x4 Matrix
mat4.scale(...): Matrix4x4
Create Translation 4x4 Matrix
mat4.translate($translation: Vector3): Matrix4x4
Degree to Radian Factor
math.DEG2RAD(): Float
Epsilon
math.EPSILON(): Float
G
math.G(): Float
PI
math.PI(): Float
Return Number as Positive Number
math.abs($value: Number): Number
Return Number to be Positive within given Range
math.absmod($value: Number, $range: Number): Number
Compute acos
math.acos($value: Float): Float
Compute asin
math.asin($value: Float): Float
Compute atan
math.atan($value: Float): Float
Compute atan2
math.atan2($y: Float, $x: Float): Float
Round Float up to next higher Integer
math.ceil($value: Float): Float
Return Number clamped to be in given Range
math.clamp($value: Number, $min: Number, $max: Number): Number
Compute acos
math.cos($value: Float): Float
Compute exp
math.exp($value: Float): Float
Round Float down to next lower Integer
math.floor($value: Float): Float
Compute log
math.log($value: Float): Float
Return maximum Number of given Values
math.max($a: Number, $b: Number): Number
Return minimum Number of given Values
math.min($a: Number, $b: Number): Number
Compute Modulo/Remainder
math.mod($value: Number, $range: Number): Number
Compute pow
math.pow($a: Number, $b: Number): Number
Create a random Number between 0.0 and 1.0
math.random(): Float
Round Float Up or Down to Integer
math.round($value: Float): Float
Return Sign of given Number
math.sign($value: Number): Number
Compute sin
math.sin($value: Float): Float
Compute Square Root
math.sqrt($value: Float): Float
Compute Square Product
math.square($value: Number): Number
Compute tan
math.tan($value: Float): Float
Compute Modulo
mod($value: Number, $range: Number): Number
Multiply
mul($a: Mixed, $b: Mixed): Mixed
Logical Not
not($bool: Boolean): Boolean
Logical Not Equal
notEqual($a: Mixed, $b: Mixed): Boolean
Logical Or
or($a: Boolean, $b: Boolean): Boolean
Prefix Decrement
prefixDecrement(=$variable: Integer): Integer
Prefix Increment
prefixIncrement(=$variable: Integer): Integer
Compute 4x4 Rotation Matrix from Quaternion
quaternion.computeMatrix($quaternion: Quaternion): Matrix4x4
Create Identity Quaternion
quaternion.identity(): Quaternion
Create Quaternion Inverse
quaternion.invert($quaternion: Vector4): Quaternion
Multiply Quaternion with Quaternion or Vector3
quaternion.multiply($quaternion: Quaternion, ...): Mixed
Normalize Quaternion
quaternion.normalize($quaternion: Quaternion): Quaternion
Create Rotation Quaternion
quaternion.rotate($axis: Vector3, $angle: Float): Quaternion
Return from Function with optional Return Value
return([$value: Mixed]): Void
Get Named Conditions
script.getNamedConditions(): String
Get Script Variables
script.getVariables(): Map
Call Script Function
script.call($function: String, ...): Mixed
Disable a specific Named Condition
script.disableNamedCondition($name: String): Void
Emit a Condition
script.emit($condition: String): Void
Enable a specific Named Condition
script.enableNamedCondition($name: String): Void
Evaluate a Script Statement
script.evaluate($statement: String): Mixed
Stop Script
script.stop(): Void
Wait for given Milliseconds
script.wait($time: Integer): Void
Wait for Condition to happen
script.waitForCondition(): Void
Create Set
set(): Set
Has Key in Set
set.has($set: Set, $key: String): Boolean
Get Set Keys
set.getKeys($set: Set): Array
Insert Key into Set
set.insert(=$set: Set, $key: String): Void
Remove Key from Set
set.remove(=$set: Set, $key: String): Void
Create String
string($string: String): String
Test if String Value is a Float Number
string.isFloat($string: String): Boolean
Test if String Value is a Integer Number
string.isInteger($string: String): Boolean
Return Character of String at given Position
string.charAt($string: String, $index: Integer): String
Concatenate Strings
string.concatenate(...): String
Test if String ends with specific String
string.endsWith($string: String, $suffix: String): Boolean
Test if 2 Strings matches ignoring Case Sensitivity
string.equalsIgnoreCase($string1: String, $string2: String): Boolean
Return First Index of specific String in String
string.firstIndexOf($string: String, $what: String[, $beginIndex: Integer]): Integer
Return Index of specific String in String
string.indexOf($string: String, $what: String[, $beginIndex: Integer]): Integer
Return Last Index of specific String in String
string.lastIndexOf($string: String, $what: String[, $beginIndex: Integer]): Integer
Return String Length
string.length($string: String): Integer
Pad String Left
string.padLeft($src: String, $by: String, $toSize: Integer): String
Pad String Right
string.padRight($src: String, $by: String, $toSize: Integer): String
RegEx Match
string.regexMatch($string: String, $pattern: String): Boolean
RegEx Replace
string.regexReplace($string: String, $pattern: String, $by: String): String
Replace specific String in String with given String
string.replace($string: String, $what: String, $by: String[, $beginIndex: Integer]): String
Create Spaces as String
string.space([$spaces: Integer]): String
Test if given String starts with specific String
string.startsWith($string: String, $prefix: String): Boolean
Return Substring of String
string.substring($string: String, $beginIndex: Integer[, $endIndex: Integer]): String
Compute Lower Case String of String
string.toLowerCase($string: String): String
Compute Upper Case String of String
string.toUpperCase($string: String): String
Tokenize String
string.tokenize($string: String, $delimiters: String): Array
Trim String
string.trim($string: String): String
Subtract
sub($a: Mixed, $b: Mixed): Mixed
Get Time as String
time.getAsString([$format: String]): String
Get Current Time in Milliseconds
time.getCurrentMillis(): Integer
Create Transform
transform([$translation: Vector3[, $scale: Vector3[, $rotationZ: Float[, $rotationY: Float[, $rotationX: Float]]]]]): Transform
X Axis as Vector3
transform.AXIS_X(): Vector3
Y Axis as Vector3
transform.AXIS_Y(): Vector3
Z Axis as Vector3
transform.AXIS_Z(): Vector3
Get Rotation Angle of specific Rotation of Transform
transform.getRotationAngle($transform: Transform, $idx: Integer): Float
Set Rotation Angle of specific Rotation of Transform
transform.setRotationAngle(=$transform: Transform, $idx: Integer, $angle: Float): Void
Set Rotation Axis of specific Rotation of Transform
transform.getRotationAxis($transform: Transform, $idx: Integer): Vector3
Compute Transform Rotations Quaternion
transform.getRotationsQuaternion($transform: Transform): Quaternion
Get Transfrom Scale
transform.getScale($transform: Transform): Vector3
Set Transfrom Scale
transform.setScale(=$transform: Transform, $scale: Vector3): Void
Get 4x4 Transform Matrix
transform.getTransformMatrix($transform: Transform): Matrix4x4
Get Transform Translation
transform.getTranslation($transform: Transform): Vector3
Set Transform Translation
transform.setTranslation(=$transform: Transform, $translation: Vector3): Void
Apply a Rotation to Transform
transform.applyRotation(=$transform: Transform, $axis: Vector3, $angle: Float): Void
Create Transform from 4x4 Matrix
transform.fromMatrix($transformMatrix: Matrix4x4): Transform
Interpolate Rotation
transform.interpolateRotation($currentAngle: Float, $targetAngle: Float, $timePassedSeconds: Float, $degreesPerSeconds: Float, =$interpolatedAngle: Float): Boolean
Multiply Transform with Vector3
transform.multiply($transform: Transform, $vec3: Vector3): Vector3
Rotate Vector3 using Transform
transform.rotate($transform: Transform, $vec3: Vector3): Vector3
Create Vector2
vec2($x: Float, $y: Float): Vector2
Compute Vector2 Dot Product
vec2.computeDotProduct($a: Vector2, $b: Vector2): Float
Compute Vector2 Length
vec2.computeLength($vec2: Vector2): Float
Compute Vector2 Squared Length
vec2.computeLengthSquared($vec2: Vector2): Float
Return Vector2 X Component
vec2.getX($vec2: Vector2): Float
Return Vector2 Y Component
vec2.getY($vec2: Vector2): Float
Normalize Vector2
vec2.normalize($vec2: Vector2): Vector2
Create Vector3
vec3($x: Float, $y: Float, $z: Float): Vector3
Compute Angle between two Vector3
vec3.computeAngle($a: Vector3, $b: Vector3, $n: Vector3): Float
Compute Vector3 Cross Product
vec3.computeCrossProduct($a: Vector3, $b: Vector3): Vector3
Compute Vector3 Dot Product
vec3.computeDotProduct($a: Vector3, $b: Vector3): Float
Compute Vector3 Length
vec3.computeLength($vec3: Vector3): Float
Compute Vector3 Squared Length
vec3.computeLengthSquared($vec3: Vector3): Float
Return Vector3 X Component
vec3.getX($vec3: Vector3): Float
Return Vector3 Y Component
vec3.getY($vec3: Vector3): Float
Return Vector3 Z Component
vec3.getZ($vec3: Vector3): Float
Normalize Vector3
vec3.normalize($vec3: Vector3): Vector3
Create Vector4
vec4($x: Float, $y: Float, $z: Float, $w: Float): Vector4
Compute Vector4 Dot Product
vec4.computeDotProduct($a: Vector4, $b: Vector4): Float
Compute Vector4 Length
vec4.computeLength($vec4: Vector4): Float
Compute Vector4 Squared Length
vec4.computeLengthSquared($vec4: Vector4): Float
Return Vector4 W Component
vec4.getW($vec4: Vector4): Float
Return Vector4 X Component
vec4.getX($vec4: Vector4): Float
Return Vector4 Y Component
vec4.getY($vec4: Vector4): Float
Return Vector4 Z Component
vec4.getZ($vec4: Vector4): Float
Normalize Vector4
vec4.normalize($vec4: Vector4): Vector4
Create XML Tag
xml.createTag($name: String[, $attributes: Map[, $innerXML: String]]): String

7. MiniScript logic methods

MiniScript logic methods
Get Engine Entity Id by Mouse Position
engine.getEntityIdByMousePosition($mouseX: Integer, $mouseY: Integer): String
Get Engine Height
engine.getHeight(): Integer
Compute Engine Screen Coordinate by World Coordinate
engine.computeScreenCoordinateByWorldCoordinate($worldCoodinate: Vector3, =$screenCoordinate: Vector2): Boolean
Get Engine Width
engine.getWidth(): Integer
Compute Engine World Coordinate by Mouse Position
engine.computeWorldCoordinateByMousePosition($mouseX: Integer, $mouseY: Integer): Vector3
Get Camera horizontal Field Of View
engine.camera.getFovX(): Float
Set Camera horizontal Field Of View
engine.camera.setFovX($fovX: Float): Void
Get Camera Look At
engine.camera.getLookAt(): Vector3
Set Camera Look At
engine.camera.setLookAt($lookAt: Vector3): Void
Get Camera Look From
engine.camera.getLookFrom(): Vector3
Set Camera Look From
engine.camera.setLookFrom($lookFrom: Vector3): Void
Get Camera Up Vector
engine.camera.getUpVector(): Vector3
Set Camera Up Vector
engine.camera.setUpVector($upVector: Vector3): Void
Compute Camera Up Vector
engine.camera.computeUpVector($lookFrom: Vector3, $lookAt: Vector3): Vector3
Get Engine Entity Animation
engine.entity.getAnimation($entityId: String[, $childEntityId: String]): String
Set Engine Entity Animation
engine.entity.setAnimation($entityId: String, $animation: String[, $speed: Float[, $childEntityId: String]]): Void
Get Engine Entity Animation Speed
engine.entity.setAnimationSpeed($entityId: String, $speed: Float[, $childEntityId: String]): Void
Set Engine Entity Animation Speed
engine.entity.getAnimationTime($entityId: String[, $childEntityId: String]): Float
Get Engine Entity Additive Effect Color
engine.entity.getEffectColorAdd($entityId: String[, $childEntityId: String]): Vector4
Set Engine Entity Additive Effect Color
engine.entity.setEffectColorAdd($entityId: String, $effectColorAdd: Vector4[, $childEntityId: String]): Void
Get Engine Entity Multiplicative Effect Color
engine.entity.getEffectColorMul($entityId: String[, $childEntityId: String]): Vector4
Set Engine Entity Multiplicative Effect Color
engine.entity.setEffectColorMul($entityId: String, $effectColorMul: Vector4[, $childEntityId: String]): Void
Return if Engine Entity is enabled
engine.entity.isEnabled($entityId: String[, $childEntityId: String]): Boolean
Set Engine Entity enabled/disabled
engine.entity.setEnabled($entityId: String, $enabled: Boolean[, $childEntityId: String]): Void
Get Engine Entity Node Transform
engine.entity.getNodeTransform($entityId: String, $nodeId: String[, $childEntityId: String]): Transform
Set Engine Entity Node Transform
engine.entity.setNodeTransform($entityId: String, $nodeId: String, $transform: Transform[, $childEntityId: String]): Void
Unset Engine Entity Node Transform
engine.entity.unsetNodeTransform($entityId: String, $nodeId: String[, $childEntityId: String]): Void
Get Engine Entity Node Transform Matrix
engine.entity.getNodeTransformMatrix($entityId: String, $nodeId: String[, $childEntityId: String]): Matrix4x4
Set Engine Entity Node Transform Matrix
engine.entity.setNodeTransformMatrix($entityId: String, $nodeId: String, $matrix: Matrix4x4[, $childEntityId: String]): Void
Unset Engine Entity Node Transform Matrix
engine.entity.unsetNodeTransformMatrix($entityId: String, $nodeId: String[, $childEntityId: String]): Void
Return if Engine Entity has specific Overlay Animation
engine.entity.hasOverlayAnimation($entityId: String, $animation: String[, $childEntityId: String]): Boolean
Return Engine Entity Overlay Animation Playback Time from 0.0 until 1.0
engine.entity.getOverlayAnimationTime($entityId: String, $animation: String[, $childEntityId: String]): Float
Return if Engine Entity is Pickable
engine.entity.isPickable($entityId: String[, $childEntityId: String]): Boolean
Set Engine Entity Pickable
engine.entity.setPickable($entityId: String, $pickable: Boolean[, $childEntityId: String]): Void
Get Engine Entity Transform
engine.entity.getTransform($entityId: String[, $childEntityId: String]): Transform
Set Engine Entity Transform
engine.entity.setTransform($entityId: String, $transform: Transform[, $childEntityId: String]): Void
Add Engine Entity Overlay Animation
engine.entity.addOverlayAnimation($entityId: String, $animation: String[, $childEntityId: String]): Void
Emit Engine Entity Particles
engine.entity.emitParticles($entityId: String[, $childEntityId: String]): Integer
Remove finished Overlay Animations
engine.entity.removeFinishedOverlayAnimations($entityId: String[, $childEntityId: String]): Void
Remove specific Overlay Animation
engine.entity.removeOverlayAnimation($entityId: String, $animation: String[, $childEntityId: String]): Void
Remove Overlay Animations
engine.entity.removeOverlayAnimations($entityId: String[, $childEntityId: String]): Void
Get Engine Timing Avarage FPS
engine.timing.getAvarageFPS(): Float
Get Engine Timing Frame Delta Time in Milliseconds
engine.timing.getDeltaTime(): Integer
Get Engine Timing Frame Delta Time in Seconds
engine.timing.getDeltaTimeSeconds(): Float
Returns if ALT Key is currently pressed
input.keyboard.isAltDown(): Boolean
Returns if specific Character is currently pressed
input.keyboard.isCharDown($charAsString: String): Boolean
Returns if CONTROL Key is currently pressed
input.keyboard.isControlDown(): Boolean
Backspace Key Keycode
input.keyboard.KEYCODE_BACKSPACE(): Integer
Delete Key Keycode
input.keyboard.KEYCODE_DELETE(): Integer
Down Key Keycode
input.keyboard.KEYCODE_DOWN(): Integer
End Key Keycode
input.keyboard.KEYCODE_END(): Integer
Escape Key Keycode
input.keyboard.KEYCODE_ESCAPE(): Integer
F1 Key Keycode
input.keyboard.KEYCODE_F1(): Integer
F10 Key Keycode
input.keyboard.KEYCODE_F10(): Integer
F11 Key Keycode
input.keyboard.KEYCODE_F11(): Integer
F12 Key Keycode
input.keyboard.KEYCODE_F12(): Integer
F2 Key Keycode
input.keyboard.KEYCODE_F2(): Integer
F3 Key Keycode
input.keyboard.KEYCODE_F3(): Integer
F4 Key Keycode
input.keyboard.KEYCODE_F4(): Integer
F5 Key Keycode
input.keyboard.KEYCODE_F5(): Integer
F6 Key Keycode
input.keyboard.KEYCODE_F6(): Integer
F7 Key Keycode
input.keyboard.KEYCODE_F7(): Integer
F8 Key Keycode
input.keyboard.KEYCODE_F8(): Integer
F9 Key Keycode
input.keyboard.KEYCODE_F9(): Integer
Left Key Keycode
input.keyboard.KEYCODE_LEFT(): Integer
Page Down Key Keycode
input.keyboard.KEYCODE_PAGEDOWN(): Integer
Page Up Key Keycode
input.keyboard.KEYCODE_PAGEUP(): Integer
Home/Position 1 Key Keycode
input.keyboard.KEYCODE_POS1(): Integer
Return Key Keycode
input.keyboard.KEYCODE_RETURN(): Integer
Right Key Keycode
input.keyboard.KEYCODE_RIGHT(): Integer
Space Key Keycode
input.keyboard.KEYCODE_SPACE(): Integer
Up Key Keycode
input.keyboard.KEYCODE_UP(): Integer
Returns if specific Key is currently pressed
input.keyboard.isKeyDown($keyCode: Integer): Boolean
Returns if Meta Key is currently pressed
input.keyboard.isMetaDown(): Boolean
Returns if Shift Key is currently pressed
input.keyboard.isShiftDown(): Boolean
Returns last typed String
input.keyboard.getTypedString(): String
Left Mouse Button Integer Code
input.mouse.BUTTON_LEFT(): Integer
Middle Mouse Button Integer Code
input.mouse.BUTTON_MIDDLE(): Integer
Right Mouse Button Integer Code
input.mouse.BUTTON_RIGHT(): Integer
Returns if specific Mouse Button is currently pressed
input.mouse.isButtonDown($button: Integer): Boolean
Returns if specific Mouse Button has been released
input.mouse.isButtonUp($button: Integer): Boolean
Returns if Mouse is dragging currently
input.mouse.isDragging($button: Integer): Boolean
Returns if Mouse has been moved
input.mouse.hasMoved(): Boolean
Returns current Value of X Axis Mouse Wheel
input.mouse.getWheelX(): Float
Returns current Value of Y Axis Mouse Wheel
input.mouse.getWheelY(): Float
Returns current Value of Z Axis Mouse Wheel
input.mouse.getWheelZ(): Float
Get X Mouse Position
input.mouse.getX(): Integer
Get Unscaled X Mouse Position
input.mouse.getXUnscaled(): Integer
Get Y Mouse Position
input.mouse.getY(): Integer
Get Unscaled Y Mouse Position
input.mouse.getYUnscaled(): Integer
Get Logic Id
logic.getId(): String
Call specific Logic Function
logic.call($logicId: String, $function: String, ...): Mixed
Returns if Signal has been sent
logic.signal.has(): Boolean
Get Signal Argument
logic.signal.getArgument($argumentIndex: Integer): Mixed
Get Signal Name
logic.signal.getName(): String
Advance to next Signal
logic.signal.next(): Void
Send Signal
logic.signal.send($logicId: String, $signal: String, ...): Void
Pathfinding Idle State Integer Code
pathfinding.STATE_IDLE(): Integer
Pathfinding Computing State Integer Code
pathfinding.STATE_PATHFINDING(): Integer
Pathfinding Failed State Integer Code
pathfinding.STATE_PATHFINDING_FAILED(): Integer
Pathfinding Computing Other Pathfinding Integer Code
pathfinding.STATE_PATHFINDING_OTHER(): Integer
Pathfinding Success State Integer Code
pathfinding.STATE_PATHFINDING_SUCCESS(): Integer
Pathfinding Try/Lock Failed Integer Code
pathfinding.STATE_TRYLOCK_FAILED(): Integer
Issue Pathfinding
pathfinding.findPath($logicId: String, $startPosition: Vector3, $endPosition: Vector3, =$path: Array): Integer
Add Prototype using SceneConnector
sceneconnector.addPrototype($pathName: String, $fileName: String, $id: String, $transform: Transform[, $entityHierarchyId: String[, $entityHierarchyParentId: String]]): Void
Get Physics World Entity Angular Damping
world.body.getAngularDamping($bodyId: String): Float
Set Physics World Entity Angular Damping
world.body.setAngularDamping($bodyId: String, $angularDamping: Float): Void
Get Physics World Entity Angular Velocity
world.body.getAngularVelocity($bodyId: String): Vector3
Set Physics World Entity Angular Velocity
world.body.setAngularVelocity($bodyId: String, $angularVelocity: Vector3): Void
Returns Physics World Collision Type Id 10
world.body.COLLISION_TYPEID_10(): Integer
Returns Physics World Collision Type Id 11
world.body.COLLISION_TYPEID_11(): Integer
Returns Physics World Collision Type Id 12
world.body.COLLISION_TYPEID_12(): Integer
Returns Physics World Collision Type Id 13
world.body.COLLISION_TYPEID_13(): Integer
Returns Physics World Collision Type Id 14
world.body.COLLISION_TYPEID_14(): Integer
Returns Physics World Collision Type Id 15
world.body.COLLISION_TYPEID_15(): Integer
Returns Physics World Collision Type Id 16
world.body.COLLISION_TYPEID_16(): Integer
Returns Physics World Collision Type Id 3
world.body.COLLISION_TYPEID_3(): Integer
Returns Physics World Collision Type Id 4
world.body.COLLISION_TYPEID_4(): Integer
Returns Physics World Collision Type Id 5
world.body.COLLISION_TYPEID_5(): Integer
Returns Physics World Collision Type Id 6
world.body.COLLISION_TYPEID_6(): Integer
Returns Physics World Collision Type Id 7
world.body.COLLISION_TYPEID_7(): Integer
Returns Physics World Collision Type Id 8
world.body.COLLISION_TYPEID_8(): Integer
Returns Physics World Collision Type Id 9
world.body.COLLISION_TYPEID_9(): Integer
Returns All Physics World Collision Type Ids
world.body.COLLISION_TYPEID_ALL(): Integer
Returns Dynamic Physics World Collision Type Id
world.body.COLLISION_TYPEID_DYNAMIC(): Integer
Returns Static Physics World Collision Type Id
world.body.COLLISION_TYPEID_STATIC(): Integer
Get Physics World Entity own Collision Type Id
world.body.getCollisionTypeId($bodyId: String): Integer
Set Physics World Entity own Collision Type Id
world.body.setCollisionTypeId($bodyId: String, $collisionTypeId: Integer): Void
Get Physics World Entity enabled Collision Type Ids
world.body.getCollisionTypeIds($bodyId: String): Integer
Set Physics World Entity enabled Collision Type Ids
world.body.setCollisionTypeIds($bodyId: String, $collisionTypeIds: Integer): Void
Returns if Physics World Entity is enabled
world.body.isEnabled($bodyId: String): Boolean
Set Physics World Entity enabled/disabled
world.body.setEnabled($bodyId: String, $enabled: Boolean): Void
Get Physics World Entity Linear Damping
world.body.getLinearDamping($bodyId: String): Float
Set Physics World Entity Linear Damping
world.body.setLinearDamping($bodyId: String, $linearDamping: Float): Void
Get Physics World Entity Linear Velocity
world.body.getLinearVelocity($bodyId: String): Vector3
Set Physics World Entity Linear Velocity
world.body.setLinearVelocity($bodyId: String, $linearVelocity: Vector3): Void
Returns Physics World Collision Body Type Integer Code
world.body.TYPE_COLLISION(): Integer
Returns Physics World Dynamic Rigid Body Type Integer Code
world.body.TYPE_DYNAMIC(): Integer
=Returns Physics World Static Rigid Body Type Integer Code
world.body.TYPE_STATIC(): Integer
Get Physics World Entity Transform
world.body.getTransform($bodyId: String): Transform
Set Physics World Entity Transform
world.body.setTransform($bodyId: String, $transform: Transform): Void
Get Physics World Entity Body Type Integer Code
world.body.getType($bodyId: String): Integer
Add Force to Physics World Entity
world.body.addForce($bodyId: String, $force: Vector3[, $origin: Vector3]): Void
Add Torque to Physics World Entity
world.body.addTorque($bodyId: String, $torque: Vector3): Void
Determine Height at specific Position in Physics World
world.determineHeight($collisionTypeIds: Integer, $stepUpMax: Float, $point: Vector3, =$heightPoint: Vector3[, =$bodyId: String[, $minHeight: Float[, $maxHeight: Float]]]): Boolean
Determine Collision of Two Specific Bodies in Physics World
world.doCollide($bodyId1: String, $bodyId2: String): Boolean
Compute Ray Casting in Physics World
world.doRayCasting($collisionTypeIds: Integer, $start: Vector3, $end: Vector3, =$hitPoint: Vector3, =$bodyId: String[, $actorId: String]): Boolean
Determine Collision of Specific Body in Physics World
world.doesCollideWith($collisionTypeIds: Integer, $bodyId: String): Array

8. MiniScript GUI methods

MiniScript GUI methods
Returns if GUI Element Node has a specific Condition enabled
gui.elementnode.conditions.has($elementNodeId: String, $condition: String): Boolean
Get enabled GUI Element Node Conditions
gui.elementnode.conditions.get($elementNodeId: String): Array
Set enabled GUI Element Node Condition
gui.elementnode.conditions.set($elementNodeId: String, $condition: String): Void
Set Array of enabled GUI Element Node Conditions
gui.elementnode.conditions.setAll($elementNodeId: String, $conditions: Array): Void
Add enabled GUI Element Node Condition
gui.elementnode.conditions.add($elementNodeId: String, $condition: String): Void
Remove enabled GUI Element Node Condition
gui.elementnode.conditions.remove($elementNodeId: String, $condition: String): Void
Remove All enabled GUI Element Node Conditions
gui.elementnode.conditions.removeAll($elementNodeId: String): Void
Returns GUI Event Performed Action Type Integer Code
gui.event.ACTIONTYPE_PERFORMED(): Integer
Returns GUI Event Performing Action Type Integer Code
gui.event.ACTIONTYPE_PERFORMING(): Integer
Get Image Source of GUI Image Node
gui.imagenode.getSource($imageNodeId: String): String
Set Image Source of GUI Image Node
gui.imagenode.setSource($imageNodeId: String, $source: String): Void
Get GUI Node Controller Value
gui.node.controller.getValue($nodeId: String): String
Set GUI Node Controller Value
gui.node.controller.setValue($nodeId: String, $value: String): Void
Add Sub Nodes using XML to GUI Parent Node
gui.parentnode.addSubNodes($parentNodeId: String, $xml: String[, $resetScrollOffsets: Boolean]): Void
Clear Sub Nodes of GUI Parent Node
gui.parentnode.clearSubNodes($parentNodeId: String): Void
Replace Sub Nodes using XML of GUI Parent Node
gui.parentnode.replaceSubNodes($parentNodeId: String, $xml: String[, $resetScrollOffsets: Boolean]): Void
Return if GUI Screen is enabled
gui.screen.isEnabled($screenId: String): Boolean
Set GUI Screen enabled/disabled
gui.screen.setEnabled($screenId: String, $enabled: Boolean): Void
Call specific Screen Logic Function
gui.screen.call($screenId: String, $function: String, ...): Mixed
Goto current Screen to specific Screen
gui.screen.goto($fileName: String[, $variables: Map[, $arguments: Mixed]]): Void
Pop current Screen from Screen Stack
gui.screen.pop(): Void
Push Screen to current Screen Stack
gui.screen.push($fileName: String[, $variables: Map[, $arguments: Mixed]]): Void
Get Current Screen Node Id
gui.screennode.getId(): String
Get Text of GUI Text Node
gui.textnode.getText($textNodeId: String): String
Set Text of GUI Text Node
gui.textnode.setText($textNodeId: String, $text: String): Void
Get Video Source of GUI Video Node
gui.videonode.getSource($videoNodeId: String): String
Set Video Source of GUI Video Node
gui.videonode.setSource($videoNodeId: String, $source: String): Void
Returns if ALT Key is currently pressed
input.keyboard.isAltDown(): Boolean
Returns if specific Character is currently pressed
input.keyboard.isCharDown($charAsString: String): Boolean
Returns if CONTROL Key is currently pressed
input.keyboard.isControlDown(): Boolean
Backspace Key Keycode
input.keyboard.KEYCODE_BACKSPACE(): Integer
Delete Key Keycode
input.keyboard.KEYCODE_DELETE(): Integer
Down Key Keycode
input.keyboard.KEYCODE_DOWN(): Integer
End Key Keycode
input.keyboard.KEYCODE_END(): Integer
Escape Key Keycode
input.keyboard.KEYCODE_ESCAPE(): Integer
F1 Key Keycode
input.keyboard.KEYCODE_F1(): Integer
F10 Key Keycode
input.keyboard.KEYCODE_F10(): Integer
F11 Key Keycode
input.keyboard.KEYCODE_F11(): Integer
F12 Key Keycode
input.keyboard.KEYCODE_F12(): Integer
F2 Key Keycode
input.keyboard.KEYCODE_F2(): Integer
F3 Key Keycode
input.keyboard.KEYCODE_F3(): Integer
F4 Key Keycode
input.keyboard.KEYCODE_F4(): Integer
F5 Key Keycode
input.keyboard.KEYCODE_F5(): Integer
F6 Key Keycode
input.keyboard.KEYCODE_F6(): Integer
F7 Key Keycode
input.keyboard.KEYCODE_F7(): Integer
F8 Key Keycode
input.keyboard.KEYCODE_F8(): Integer
F9 Key Keycode
input.keyboard.KEYCODE_F9(): Integer
Left Key Keycode
input.keyboard.KEYCODE_LEFT(): Integer
Page Down Key Keycode
input.keyboard.KEYCODE_PAGEDOWN(): Integer
Page Up Key Keycode
input.keyboard.KEYCODE_PAGEUP(): Integer
Home/Position 1 Key Keycode
input.keyboard.KEYCODE_POS1(): Integer
Return Key Keycode
input.keyboard.KEYCODE_RETURN(): Integer
Right Key Keycode
input.keyboard.KEYCODE_RIGHT(): Integer
Space Key Keycode
input.keyboard.KEYCODE_SPACE(): Integer
Up Key Keycode
input.keyboard.KEYCODE_UP(): Integer
Returns if specific Key is currently pressed
input.keyboard.isKeyDown($keyCode: Integer): Boolean
Returns if Meta Key is currently pressed
input.keyboard.isMetaDown(): Boolean
Returns if Shift Key is currently pressed
input.keyboard.isShiftDown(): Boolean
Returns last typed String
input.keyboard.getTypedString(): String
Left Mouse Button Integer Code
input.mouse.BUTTON_LEFT(): Integer
Middle Mouse Button Integer Code
input.mouse.BUTTON_MIDDLE(): Integer
Right Mouse Button Integer Code
input.mouse.BUTTON_RIGHT(): Integer
Returns if specific Mouse Button is currently pressed
input.mouse.isButtonDown($button: Integer): Boolean
Returns if specific Mouse Button has been released
input.mouse.isButtonUp($button: Integer): Boolean
Returns if Mouse is dragging currently
input.mouse.isDragging($button: Integer): Boolean
Returns if Mouse has been moved
input.mouse.hasMoved(): Boolean
Returns current Value of X Axis Mouse Wheel
input.mouse.getWheelX(): Float
Returns current Value of Y Axis Mouse Wheel
input.mouse.getWheelY(): Float
Returns current Value of Z Axis Mouse Wheel
input.mouse.getWheelZ(): Float
Get X Mouse Position
input.mouse.getX(): Integer
Get Unscaled X Mouse Position
input.mouse.getXUnscaled(): Integer
Get Y Mouse Position
input.mouse.getY(): Integer
Get Unscaled Y Mouse Position
input.mouse.getYUnscaled(): Integer
Call specific Logic Function
logic.call($logicId: String, $function: String, ...): Mixed
Send Signal
logic.signal.send($logicId: String, $signal: String, ...): Void

9. Operators

Op Method
! not($bool: Boolean): Boolean
!= notEqual($a: Mixed, $b: Mixed): Boolean
% mod($value: Number, $range: Number): Number
& bitwiseAnd($a: Integer, $b: Integer): Integer
&& and($a: Boolean, $b: Boolean): Boolean
* mul($a: Mixed, $b: Mixed): Mixed
+ add($a: Mixed, $b: Mixed): Mixed
++ prefixIncrement(=$variable: Integer): Integer
- sub($a: Mixed, $b: Mixed): Mixed
-- prefixDecrement(=$variable: Integer): Integer
/ div($a: Mixed, $b: Mixed): Mixed
< lesser($a: Mixed, $b: Mixed): Boolean
<= lesserEquals($a: Mixed, $b: Mixed): Boolean
= setVariable($variable: String, $value: Mixed): Mixed
== equals($a: Mixed, $b: Mixed): Boolean
> greater($a: Mixed, $b: Mixed): Boolean
>= greaterEquals($a: Mixed, $b: Mixed): Boolean
| bitwiseOr($a: Integer, $b: Integer): Integer
|| or($a: Boolean, $b: Boolean): Boolean
^ bitwiseXor($a: Integer, $b: Integer): Integer
~ bitwiseNot($value: Integer): Integer