Skip to content

Latest commit

 

History

History
2261 lines (2028 loc) · 206 KB

README-MiniScript.md

File metadata and controls

2261 lines (2028 loc) · 206 KB

LOGO

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

1. Introduction

MiniScript was developed as part of our TDME2 3D Engine to match the requirements for high performance script execution, as well as straight forward game logic scripting.

MiniScript might borrow some ideas from JavaScript, Kotlin, PHP and even C++, which you might like and find familier. Also note the focus on easy integration into other products and easy customizability and extendability.

1.1. Open source

1.2. Language features

  • 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
    • can be easily extended by writing state machine machine states and script methods in C++ as well as custom data types
    • built-in data types: null, boolean, integer, float, string, byte array, array, map, set, vector2, vector3, vector4, quaternion, matrix3x3, matrix4x4, transform, ...
    • when calling script C++ methods or script functions with arguments it does optionally use references or value by copy
    • supports functions and recursion
    • supports inline/lamda functions
    • supports operators by operator to method mapping by a preprocessor run
    • supports loops and conditions
    • supports programming with classes style programming
      • for built-in datatypes: string, byte array, array, map, set, vector2, vector3, vector4, quaternion, matrix3x3, matrix4x4, transform, ...
      • for script classes/objects
      • for custom data types
    • supports event like programming
    • unicode support via UTF8
    • 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.printLine("i -> 1")
	end
...

See an example of if and else and end:

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

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

...
	$i = 2
	console.printLine($i, ":")
	if ($i == 0)
		console.printLine("i -> 0")
	elseif ($i == 1)
		console.printLine("i -> 1")
	elseif ($i == 2)
		console.printLine("i -> 2")
	elseif ($i == 3)
		console.printLine("i -> 3")
	else
		console.printLine("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.printLine($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.printLine("$ = ", $i)
		++$i
	end
...

3. Functions/Callables

See this example that shows functions and recursion.

Argument variables, parsed in function declarations are populated in function context with corresponding values.

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

If a argument(variable) is prefixed with a & operator in the function declaration, the variable will not be copied into the function arguments, but a reference will be created, means if this variable changes within the function it will also change in the parent variable scope. See &$b and &$c.

Be aware that value by copy variables usually require more instantiation time due to the copy that needs to be made of the variable from parent variable scope to function variable scope.

...
# function to test references in user functions
function: assignTest($a, &$b, &$c)
	$a = "a"
	$b = "b"
	$c = "c"
end
...
	$a = "0"
	$b = "1"
	$c = "2"
	console.printLine("assignTest(): pre: $a = " + $a + ", $b = " + $b + ", $c = " + $c)
	assignTest($a, $b, $c)
	console.printLine("assignTest(): post: $a = " + $a + ", $b = " + $b + ", $c = " + $c)
...

Global variables can always be accessed by using the "$$." or "$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 "$$." or "$GLOBAL." accessor.

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

A special type of functions are callables. Callables are functions that are used to interact between MiniScript scripts.

Despite the fact that a callable function of a script can be called from another script, they have the limitation that they must not contain MiniScript C++ method calls that require a context function.

Context functions are functions that require a special context.

...
# call this callable to select this unit 
callable: select()
	$GLOBAL.selectMode = "select"
end
...
# call this callable to unselect this unit 
callable: unselect()
	$GLOBAL.selectMode = "unselect"
end
...
# update engine (context) function
function: updateEngine()
	...
	# selection
	if ($GLOBAL.selectMode == "select")
		engine.entity.setEnabled(logic.getId(), true, "selection")
		$GLOBAL.selectMode = "none"
	elseif ($GLOBAL.selectMode == "unselect")
		engine.entity.setEnabled(logic.getId(), false, "selection")
		$GLOBAL.selectMode = "none"
	end
	...
end
...

4. Data types and variables

MiniScript works with the following data types:

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

Variable identifiers always start with a "$". Constants need also be prefixed with a "$" and should be named with uppercase letters like "$PI = 3.14". You can manually set variables with the setVariable("$variableName", ...) or constants with setConstant("$CONSTANT", ...) methods.

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. Byte arrays

A byte array is a sequence of byte values. Bytes are the smallest atomic values a CPU does handle. Using bit math you can also manipulate byte values at bit scope.

To write and read from byte array you can use the read*() and write*() methods.

Available data types are

  • bool (true or false)
  • int8 (-128 .. 127)
  • int16 (-32768 .. 32767)
  • int32 (-2147483647 .. 2147483646)
  • int64 (-9,223,372,036,854,775,807 .. -9,223,372,036,854,775,806)
  • float (floating point number)
  • small string (string with maximum size of 255 bytes)
  • medium string (string with maximum size of 65535 bytes)
  • large string (string with maximum size of 4294967295 bytes)

You can get/set the position for reading from and writing to byte array by using the getReadPosition()/setReadPosition() and getWritePosition()/setWritePosition().

If you read from or write to byte array the corresponding position will be advanced automatically.

Usually byte arrays can be used to exchange/construct network packets/streams, texture data, mesh data, ... Also, using a byte array instead of a generic array for byte storage, results in using much less memory space.

Initializing a byte array by constructor:

...
	$byteArray = ByteArray()
...

Writing values using ByteArray::write*():

...
	$byteArray->setWritePosition(0)
	$byteArray->writeBool(true)
	$byteArray->writeInt8(1)
	$byteArray->writeInt16(2)
	$byteArray->writeInt32(3)
	$byteArray->writeInt64(4)
	$byteArray->writeFloat(1234.5678)
	$byteArray->writeSmallString("Hi there! I am a small sized string.")
	$byteArray->writeMediumString("Hi there! I am a medium sized string.")
	$byteArray->writeLargeString("Hi there! I am a large sized string.")
...

Reading values using ByteArray::read*():

...
	$byteArray->setReadPosition(0)
	console.printLine($byteArray->readBool())
	console.printLine($byteArray->readInt8())
	console.printLine($byteArray->readInt16())
	console.printLine($byteArray->readInt32())
	console.printLine($byteArray->readInt64())
	console.printLine($byteArray->readFloat())
	console.printLine($byteArray->readSmallString())
	console.printLine($byteArray->readMediumString())
	console.printLine($byteArray->readLargeString())
...

Reading byte arrays using ByteArray::length() and ByteArray::readInt8():

...
	$byteArray->setReadPosition(0)
	forCondition($byteArray->getReadPosition() < $byteArray->length())
		console.printLine($i + ": " + $byteArray->readInt8($i))
	end
...

Removing from byte arrays using a index and number of bytes to remove with ByteArray::remove():

...
	$byteArray->remove(2, 3)
...

4.4. Arrays

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

Initializing an array by array initializer:

...
	$array = [1, 2, 3]
...

Initializing an array by constructor:

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

... or initialize and push values to it:

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

Pushing values using Array::push():

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

Pushing values using [] operator:

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

Removing values from arrays using Array::removeOf():

...
	$array->removeOf(6)
	$array->removeOf(7)
...

Removing from arrays using a index with Array::remove():

...
	$array->remove(2)
...

Iterating arrays using Array::length() and Array::get():

...
	$i = 0
	forCondition($i < $array->length())
		console.printLine($i + ": " + $array->get($i))
		++$i
	end
...

Iterating arrays using Array::length() and [] operator:

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

Iterating arrays using Array::forEach() and a lamda function

...
	$array->forEach(($value) -> { console.printLine($value) })
...

4.5. Maps

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

Initializing a map by map initializer

...
	$map = {"test1": 123, "test2": 456, "test3": [1, 2, 3], "test4": "Yaaaa"}
...

Initializing a map by map constructor:

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

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

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

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

...
	$map->remove("test2")
...

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

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

Reading values from map using dot operator:

...
	console.printLine("map value for test1 using map dot operator: ", $map.test1)
	console.printLine("map value for test2 using map dot operator: ", $map.test2)
	console.printLine("map value for test3 using map dot operator: ", $map.test3)
	console.printLine("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.printLine("map keys: ", $map->getKeys())
...

Reading map values:

...
	console.printLine("map values: ", $map->getValues())
...

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

...
	$mapKeys = $map->getKeys()
	$i = 0
	forCondition($i < $mapKeys->length())
		console.printLine($mapKeys[$i] + " = " + $map->get($mapKeys[$i]))
		++$i
	end
...

Iterating maps using Map::forEach() and a lamda function

...
	$map->forEach(($key, $value) -> { console.printLine($key + " = " + $value) })
...

4.6. Sets

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

Initializing a set by set initializer

...
	$set = {"test1", "test2", "test3"}
...

Initializing a set by set constructor

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

Inserting keys into set using Set::insert():

...
	$set->insert("test1")
	$set->insert("test2")
	$set->insert("test3")
...

Removing keys from set using Set::remove():

...
	$set->remove("test2")
...

Checking if keys exist in set using Set::has() and given keys:

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

Checking if keys exist in set using dot operator and given keys:

...
	console.printLine("set key for test1 using set dot operator: ", $set.test1)
	console.printLine("set key for test2 using set dot operator: ", $set.test2)
	console.printLine("set key for test3 using set dot operator: ", $set.test3)
	console.printLine("set key for test4 using set dot operator: ", $set.test4)
	console.printLine("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.printLine("set keys: ", $set->getKeys())
...

Iterating sets using Set::forEach() and a lamda function

...
	$set->forEach(($key) -> { console.printLine($key) })
...

4.7. Classes

Classes in MiniScript can be represented by maps, a constructed map with function assignments and/or definitions can be called object, see map section in 4.5.

Creating a object in MiniScript works by using map initializer plus () -> methodName function assignment, or () -> { console.dump($this) } inline function definition. Please see a example below.

...
	#
	$car = {
		# member variables
		wheelCount: 4,
		color: "blue",
		horsePower: 75,
		# member methods
		setWheelCount: ($wheelCount) -> 
			{
				$this.wheelCount = $wheelCount
			},
		setColor: ($color) ->
			{
				$this.color = $color
			},
		setHorsePower: ($horsePower) -> 
			{
				$this.horsePower = $horsePower
			},
		showMeWhatYouGot: () ->
			{
				console.printLine(
					"This amazing car has ", 
					$this.wheelCount,
					" wheels, is colored ", 
					$this.color,
					" with super nice ", 
					$this.horsePower,
					" horses in it"
				)
			},
		getProperties: (&$wheelCount, &$color, &$horsePower) -> 
			{
				$wheelCount = $this.wheelCount
				$color = $this.color
				$horsePower = $this.horsePower
			}
	}
	#
	console.dump($car)
	# arrr, lets see what kind of car we got
	$car->showMeWhatYouGot()
	# i want it in red with 3 wheels and 25 mighty horse power
	$car->setColor("red")
	$car->setWheelCount(3)
	$car->setHorsePower(25)
	# arrr, lets see what kind of car we got now!
	$car->showMeWhatYouGot()
	# lets get the properties
	$wheelCount = null
	$color = null
	$horsePower = null
	$car->getProperties($wheelCount, $color, $horsePower)
	console.printLine(
		"Car properties, wheels: ", 
		$wheelCount,
		", color: ", 
		$color,
		", horse power: ", 
		$horsePower
	)
	#...

If you want to assign a object member function later, see this example. Note that the first argument needs to be a reference or value by copy $this variable. This argument maps to the object that your code is operating on in your object member function.

Be aware that value by copy variables usually require more instantiation time due to the copy that needs to be made of the variable from parent variable scope to function variable scope.

...
function: setConvertible(&$this, $convertible)
	$this.convertible = $convertible
end

function: showMeWhatYouGot($this)
	$carType = "car"
	if ($this.convertible == true)
		$carType = "convertible"
	end
	console.printLine(
		"This amazing ", 
		$carType,
		" has ", 
		$this.wheelCount,
		" wheels, is colored ", 
		$this.color,
		" with super nice ", 
		$this.horsePower,
		" horses in it"
	)
end
	...
	#
	$car.convertible = false
	$car.setConvertible = () -> setConvertible
	$car.showMeWhatYouGot = () -> showMeWhatYouGot
	#
	console.dump($car)
	# I want a convertible, who doesn't?
	$car->setConvertible(true)
	# arrr, lets see what kind of car we got
	$car->showMeWhatYouGot()
	#...

5. Program structure and flow

... TODO ...

6. MiniScript classes

6.1. String class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create string
static String($string: String): String
Concatenate strings
static String::concatenate(...): String
Create string from byte array
static String::fromByteArray($byteArray: ByteArray): String
Generate string
static String::generate($what: String[, $count: Integer]): String
 
NON STATIC METHODS
Return character of string at given position
charAt($index: Integer): String
Test if string ends with specific string
endsWith($suffix: String): Boolean
Test if strings matches ignoring case sensitivity
equalsIgnoreCase($other: String): Boolean
Return first index of specific string in string
firstIndexOf($what: String[, $beginIndex: Integer]): Integer
Return first index of characters provided within given string in string
firstIndexOfChars($what: String[, $beginIndex: Integer]): Integer
Indent string
indent($with: String, $count: Integer): String
Return index of specific string in string
indexOf($what: String[, $beginIndex: Integer]): Integer
Test if string value is empty
isEmpty(): Boolean
Test if string value is a float number
isFloat(): Boolean
Test if string value is a integer number
isInteger(): Boolean
Return last index of specific string in string
lastIndexOf($what: String[, $beginIndex: Integer]): Integer
Return last index of characters provided within given string in string
lastIndexOfChars($what: String[, $endIndex: Integer]): Integer
Return string length
length(): Integer
Pad string left
padLeft($by: String, $toLength: Integer): String
Pad string right
padRight($by: String, $toLength: Integer): String
RegEx match
regexMatch($pattern: String): Boolean
RegEx replace
regexReplace($pattern: String, $by: String): String
Replace specific string in string with given string
replace($what: String, $by: String[, $beginIndex: Integer]): String
Test if given string starts with specific string
startsWith($prefix: String): Boolean
Return substring of string
substring($beginIndex: Integer[, $endIndex: Integer]): String
Convert string to byte array
toByteArray(): ByteArray
Compute lower case string of string
toLowerCase(): String
Compute upper case string of string
toUpperCase(): String
Tokenize string
tokenize($delimiters: String): Array
Trim string
trim(): String

6.2. Byte array class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create byte array
static ByteArray(): ByteArray
 
NON STATIC METHODS
Clear byte array
clear(): Null
Get read position
getReadPosition(): Integer
Get write position
getWritePosition(): Integer
Read bool value and advance read position by 1 byte
readBool(): ?Boolean
Read 32 bit float value and advance read position by 4 byte
readFloat(): ?Float
Read 16 bit integer value and advance read position by 2 byte
readInt16(): ?Integer
Read 16 bit integer value and advance read position by 4 byte
readInt32(): ?Integer
Read 64 bit integer value and advance read position by 8 byte
readInt64(): ?Integer
Read 8 bit integer value and advance read position by 1 byte
readInt8(): ?Integer
Read a string with maximum size of 255 bytes
readLargeString(): ?String
Read a string with maximum size of 65535 bytes
readMediumString(): ?String
Read a string with maximum size of 4294967295 bytes
readSmallString(): ?String
Remove values from byte array
remove($index: Integer, $size: Integer): Null
Set read position
setReadPosition($position: Integer): Null
Set write position
setWritePosition($position: Integer): Null
Return size of byte array
size(): Integer
Write bool value and advance write position by 1 byte
writeBool($value: Boolean): Null
Write 32 bit float value and advance write position by 4 byte
writeFloat($value: Integer): Null
Write 16 bit integer value and advance write position by 2 byte
writeInt16($value: Integer): Null
Write 32 bit integer value and advance write position by 4 byte
writeInt32($value: Integer): Null
Write 64 bit integer value and advance write position by 8 byte
writeInt64($value: Integer): Null
Write 8 bit integer value and advance write position by 1 byte
writeInt8($value: Integer): Null
Write a string with maximum size of 255 bytes
writeLargeString($value: String): Null
Write a string with maximum size of 65535 bytes
writeMediumString($value: String): Null
Write a string with maximum size of 4294967295 bytes
writeSmallString($value: String): Null

6.3. Array class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create array
static Array(...): Array
 
NON STATIC METHODS
Clear array
clear(): Null
Iterate array values, by using a (Lamda) function
forEach($function: Function[, &$cookie: Mixed]): Null
Iterate range of array values, by using a (Lamda) function
forRange($function: Function, $beginIndex: Integer[, $count: Integer[, $step: Integer[, &$cookie: Mixed]]]): Null
Get array entry
get($index: Integer): Mixed
Get array index by value
indexOf($value: String[, $beginIndex: Integer]): Integer
Get array length
length(): Integer
Add entry to array
push(...): Null
Remove array entry by index
remove($index: Integer): Null
Remove array entry by value
removeOf($value: String[, $beginIndex: Integer]): Null
Reverse array
reverse(): Null
Set array entry
set($index: Integer, $value: Mixed): Null
Sort array
sort($function: Function): Null

6.4. Map class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create map
static Map(): Map
 
NON STATIC METHODS
Clear map
clear(): Null
Iterate map key and value pairs, by using a (Lamda) function
forEach($function: Function[, &$cookie: Mixed]): Null
Get map value by key
get($key: String): Mixed
Get map keys
getKeys(): Array
Get map values
getValues(): Array
Has entry by key
has($key: String): Boolean
Remove map entry
remove($key: String): Null
Set map entry
set($key: String, $value: Mixed): Null

6.5. Set class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create set
static Set(): Set
 
NON STATIC METHODS
Clear set
clear(): Null
Iterate set keys, by using a (Lamda) function
forEach($function: Function[, &$cookie: Mixed]): Null
Get set keys
getKeys(): Array
Has key in set
has($key: String): Boolean
Insert key into set
insert($key: String): Null
Remove key from set
remove($key: String): Null

6.6. HTTP download client class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
HTTP Download Client
static HTTPDownloadClient(): HTTPDownloadClient
 
NON STATIC METHODS
Cancel download
cancel(): Null
Get file URI
getFile(): String
Get GET parameters
getGETParameters(): Map
Get headers
getHeaders(): Map
Get password
getPassword(): String
Get progress
getProgress(): Float
Get response headers
getResponseHeaders(): Map
Get HTTP status code
getStatusCode(): Integer
Get URL
getURL(): String
Get username
getUserName(): String
Returns if download has been finished
isFinished(): Boolean
Wait until download thread has finished working
join(): Null
Reset HTTP download client
reset(): Null
Set file to save file downloaded to
setFile($url: String): Null
Set GET parameters
setGETParameters($getParameters: Map): Null
Set headers
setHeaders($headers: Map): Null
Set password
setPassword($password: String): Null
Set URL
setURL($url: String): Null
Set user name
setUserName($userName: String): Null
Start download
start(): Null

6.7. Transform class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create Transform
static Transform([$translation: Vector3[, $scale: Vector3[, $rotationZ: Float[, $rotationY: Float[, $rotationX: Float]]]]]): Transform
X axis as vector3
static Transform::AXIS_X(): Vector3
Y axis as vector3
static Transform::AXIS_Y(): Vector3
Z axis as vector3
static Transform::AXIS_Z(): Vector3
Create Transform from 4x4 matrix
static Transform::fromMatrix($transformMatrix: Matrix4x4): Transform
Interpolate rotation
static Transform::interpolateRotation($currentAngle: Float, $targetAngle: Float, $timePassedSeconds: Float, $degreesPerSeconds: Float, &$interpolatedAngle: Float): Boolean
 
NON STATIC METHODS
Apply a rotation to Transform
applyRotation($axis: Vector3, $angle: Float): Null
Get rotation angle of specific rotation of Transform
getRotationAngle($idx: Integer): Float
Set rotation axis of specific rotation of Transform
getRotationAxis($idx: Integer): Vector3
Compute Transform rotations quaternion
getRotationsQuaternion(): Quaternion
Get transfrom scale
getScale(): Vector3
Get 4x4 Transform matrix
getTransformMatrix(): Matrix4x4
Get Transform translation
getTranslation(): Vector3
Rotate vector3 using Transform
rotate($vector3: Vector3): Vector3
Set rotation angle of specific rotation of Transform
setRotationAngle($idx: Integer, $angle: Float): Null
Set transfrom scale
setScale($scale: Vector3): Null
Set Transform translation
setTranslation($translation: Vector3): Null

6.8. Matrix4x4 class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create identity 4x4 matrix
static Matrix4x4::identity(): Matrix4x4
Create rotation 4x4 matrix
static Matrix4x4::rotate($axis: Vector3, $angle: Float): Matrix4x4
Create scale 4x4 matrix
static Matrix4x4::scale(...): Matrix4x4
Create translation 4x4 matrix
static Matrix4x4::translate($translation: Vector3): Matrix4x4
 
NON STATIC METHODS
Compute euler angles from 4x4 matrix
computeEulerAngles(): Vector3
Create 4x4 matrix inverse
invert(): Matrix4x4

6.9. Matrix3x3 class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create identity 3x3 matrix
static Matrix3x3::identity(): Matrix3x3
Create rotation 3x3 matrix
static Matrix3x3::rotate($angle: Float): Matrix3x3
Create 3x3 matrix which rotates around point
static Matrix3x3::rotateAroundPoint($point: Vector2, $angle: Float): Matrix3x3
Create 3x3 matrix which rotates around texture center
static Matrix3x3::rotateAroundTextureCenter($angle: Float): Matrix3x3
Create scale 3x3 matrix
static Matrix3x3::scale(...): Matrix3x3
Create translation 3x3 matrix
static Matrix3x3::translate($translation: Vector2): Matrix3x3

6.10. Quaternion class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create identity quaternion
static Quaternion::identity(): Quaternion
Create rotation quaternion
static Quaternion::rotate($axis: Vector3, $angle: Float): Quaternion
 
NON STATIC METHODS
Compute euler angles from quaternion
computeEulerAngles(): Vector3
Compute 4x4 rotation matrix from quaternion
computeMatrix(): Matrix4x4
Create quaternion inverse
invert(): Quaternion
Normalize quaternion
normalize(): Quaternion

6.11. Vector2 class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create vector2
static Vector2($x: Float, $y: Float): Vector2
Compute vector2 dot product
static Vector2::computeDotProduct($a: Vector2, $b: Vector2): Float
 
NON STATIC METHODS
Compute vector2 length
computeLength(): Float
Compute vector2 squared length
computeLengthSquared(): Float
Return vector2 x component
getX(): Float
Return vector2 y component
getY(): Float
Normalize vector2
normalize(): Vector2

6.12. Vector3 class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create vector3
static Vector3($x: Float, $y: Float, $z: Float): Vector3
Compute angle between two vector3
static Vector3::computeAngle($a: Vector3, $b: Vector3, $n: Vector3): Float
Compute vector3 cross product
static Vector3::computeCrossProduct($a: Vector3, $b: Vector3): Vector3
Compute vector3 dot product
static Vector3::computeDotProduct($a: Vector3, $b: Vector3): Float
 
NON STATIC METHODS
Compute vector3 length
computeLength(): Float
Compute vector3 squared length
computeLengthSquared(): Float
Return vector3 x component
getX(): Float
Return vector3 y component
getY(): Float
Return vector3 z component
getZ(): Float
Normalize vector3
normalize(): Vector3

6.13. Vector4 class

                                                                                          Table of methods                                                                                          
 
STATIC METHODS
Create vector4
static Vector4($x: Float, $y: Float, $z: Float, $w: Float): Vector4
Compute vector4 dot product
static Vector4::computeDotProduct($a: Vector4, $b: Vector4): Float
 
NON STATIC METHODS
Compute vector4 length
computeLength(): Float
Compute vector4 squared length
computeLengthSquared(): Float
Return vector4 w component
getW(): Float
Return vector4 x component
getX(): Float
Return vector4 y component
getY(): Float
Return vector4 z component
getZ(): Float
Normalize vector4
normalize(): Vector4

7.1. Base methods

                                                                                          Table of methods                                                                                          
Set constant
setConstant($constant: String, $value: Mixed): Mixed
Get variable
getVariable($variable: String): Mixed
Set variable
setVariable($variable: String, $value: Mixed): Mixed
Add
add($a: Mixed, $b: Mixed): Mixed
Logical and
and($a: Boolean, $b: Boolean): Boolean
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
Break out of current forCondition or forTime loop
break(): Null
Begins a case block within a switch block, which will be executed if the case value has matched
case($value: Mixed): Null
Continue to next iteration of forCondition or forTime loop
continue(): Null
Begins a default block within a switch block, which will be executed if no case value has matched
default(): Null
Divide
div($a: Mixed, $b: Mixed): Mixed
Else
else(): Null
Else if
elseif($condition: Boolean): Null
End
end(): Null
Equals
equals($a: Mixed, $b: Mixed): Boolean
For condition
forCondition($condition: Boolean): Null
For time
forTime($time: Integer): Null
Greater
greater($a: Mixed, $b: Mixed): Boolean
Greater equals
greaterEquals($a: Mixed, $b: Mixed): Boolean
If
if($condition: Boolean): Null
Create integer
int($int: Integer): Integer
Lesser
lesser($a: Mixed, $b: Mixed): Boolean
Lesser equals
lesserEquals($a: Mixed, $b: Mixed): Boolean
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
Postfix decrement
postfixDecrement(&$variable: Integer): Integer
Postfix increment
postfixIncrement(&$variable: Integer): Integer
Prefix decrement
prefixDecrement(&$variable: Integer): Integer
Prefix increment
prefixIncrement(&$variable: Integer): Integer
Return from function with optional return value
return([$value: Mixed]): Null
Subtract
sub($a: Mixed, $b: Mixed): Mixed
Begins switch block to match a given value to case values or a default
switch($value: Mixed): Null

7.2. Application methods

                                                                                          Table of methods                                                                                          
Execute Application
application.execute($command: String): String

7.3. Console methods

                                                                                          Table of methods                                                                                          
Pretty print variable to console
console.dump($value: Mixed): Null
Print to console without trainling new line
console.print(...): Null
Print to console with a trailing new line
console.printLine(...): Null
Read all input into string value
console.readAll(): String
Read all input into array of strings
console.readAllAsArray(): Array
Read a line from input
console.readLine(): String

7.4. Error console/stream methods

                                                                                          Table of methods                                                                                          
Print to error console/stream without trainling new line
console.error.print(...): Null
Print to error console/stream with a trailing new line
console.error.printLine(...): Null

7.5. Cryptography Base64 methods

                                                                                          Table of methods                                                                                          
Decode a Base64 encoded string
cryptography.base64.decode($value: String): String
Encode a string using Base64
cryptography.base64.encode($value: String): String

7.6. Cryptography SHA256 methods

                                                                                          Table of methods                                                                                          
Hash a string using SHA256
cryptography.sha256.encode($value: String): String

7.7. File System methods

                                                                                          Table of methods                                                                                          
Get canonical URI
filesystem.getCanonicalURI($pathName: String, $fileName: String): ?String
Get file content as byte array
filesystem.getContent($pathName: String, $fileName: String): ?ByteArray
Set file content from byte array
filesystem.setContent($pathName: String, $fileName: String, $content: ByteArray): Boolean
Get file content as string
filesystem.getContentAsString($pathName: String, $fileName: String): ?String
Get file content as string array
filesystem.getContentAsStringArray($pathName: String, $fileName: String): ?Array
Set file content from string
filesystem.setContentFromString($pathName: String, $fileName: String, $content: String): Boolean
Set file content from string array
filesystem.setContentFromStringArray($pathName: String, $fileName: String, $content: Array): Boolean
Get current working path name
filesystem.getCurrentWorkingPathName(): ?String
Returns if given URI is a drive name(applies to Microsoft Windows only)
filesystem.isDrive($uri: String): Boolean
Extracts file name from given URI
filesystem.getFileName($uri: String): String
Returns file size from file
filesystem.getFileSize($pathName: String, $fileName: String): ?Integer
Returns if given URI is a path
filesystem.isPath($uri: String): ?Boolean
Extracts path name from given URI
filesystem.getPathName($uri: String): String
Change current working path
filesystem.changePath($pathName: String): Boolean
Compose URI from given path name and file name
filesystem.composeURI($pathName: String, $fileName: String): String
Create path
filesystem.createPath($pathName: String): Boolean
Returns if URI does exist
filesystem.exists($uri: String): ?Boolean
List folder
filesystem.list($pathName: String): ?Array
Move file/folder from a location to another location
filesystem.move($uriFrom: String, $uriTo: String): Boolean
Removes a file with given file name
filesystem.removeFile($pathName: String, $fileName: String): Boolean
Removes a file extension from given file name
filesystem.removeFileExtension($fileName: String): String
Removes a path from file system
filesystem.removePath($pathName: String, $recursive: String): Boolean
Renames a file/folder
filesystem.rename($fileNameFrom: String, $fileNameTo: String): Boolean

7.8. Float methods

                                                                                          Table of methods                                                                                          
Create float
float($float: Float): Float
Convert integer bit representation of float to float
float.fromIntValue($int: Integer): Float
Convert float to integer bit representation of float
float.toIntValue($float: Float): Integer

7.9. JSON methods

                                                                                          Table of methods                                                                                          
Deserialize JSON
json.deserialize($json: String): Mixed
Serialize JSON
json.serialize($value: Mixed): String

7.10. Math methods

                                                                                          Table of methods                                                                                          
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($x: Float): Float
Compute asin
math.asin($x: Float): Float
Compute atan
math.atan($x: 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($x: Float): Float
Compute exp
math.exp($power: 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($value1: Number, $value2: Number): Number
Return minimum number of given values
math.min($value1: Number, $value2: Number): Number
Compute modulo/remainder
math.mod($value: Number, $range: Number): Number
Compute pow
math.pow($base: Number, $power: 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($x: Float): Float
Compute square root
math.sqrt($value: Float): Float
Compute square product
math.square($value: Number): Number
Compute tan
math.tan($x: Float): Float

7.11. HTTP/HTTPS client methods

                                                                                          Table of methods                                                                                          
Execute a HTTP/HTTPS GET request
network.httpclient.get($url: String[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS DELETE request
network.httpclient.delete($url: String[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS HEAD request
network.httpclient.head($url: String[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS POST request
network.httpclient.post($url: String, $data: Mixed[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS PUT request
network.httpclient.put($url: String, $data: Mixed[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map

7.12. Script methods

                                                                                          Table of methods                                                                                          
Get named conditions
script.getNamedConditions(): String
Returns if script runs natively
script.isNative(): Boolean
Get script variables
script.getVariables(): Map
Call script callable function
script.call($function: String, ...): Mixed
Disable a specific named condition
script.disableNamedCondition($name: String): Null
Emit a condition
script.emit($condition: String): Null
Enable a specific named condition
script.enableNamedCondition($name: String): Null
Evaluate a script statement
script.evaluate($statement: String): Mixed
Stop script
script.stop(): Null
Wait for given milliseconds
script.wait($time: Integer): Null
Wait for condition to happen
script.waitForCondition(): Null

7.13. Time methods

                                                                                          Table of methods                                                                                          
Get time as string
time.getAsString([$format: String]): String
Get current time in milliseconds
time.getCurrentMillis(): Integer

7.14. XML methods

                                                                                          Table of methods                                                                                          
Create XML tag
xml.createTag($name: String[, $attributes: Map[, $innerXML: String]]): String

8. MiniScript logic methods

The boilerplate template code for a MiniScript logic looks like: logic_script_template.tscript

8.1. Application methods

                                                                                          Table of methods                                                                                          
Returns if application runs in full screen
application.isFullScreen(): Boolean
Returns if application runs inside TDME editor
application.runsInEditor(): Boolean

8.2. Audio methods

                                                                                          Table of methods                                                                                          
Get listener orientation at - available in initializeEngine(), updateEngine()
audio.getListenerOrientationAt(): Vector3
Set listener orientation at - available in initializeEngine(), updateEngine()
audio.setListenerOrientationAt($orientation: Vector3): Null
Get listener orientation up - available in initializeEngine(), updateEngine()
audio.getListenerOrientationUp(): Vector3
Set listener orientation up - available in initializeEngine(), updateEngine()
audio.setListenerOrientationUp($orientation: Vector3): Null
Get listener position - available in initializeEngine(), updateEngine()
audio.getListenerPosition(): Vector3
Set listener position - available in initializeEngine(), updateEngine()
audio.setListenerPosition($position: Vector3): Null
Play audio at engine entity position - available in initializeEngine(), updateEngine()
audio.play($id: String[, $delay: Integer[, $gain: Integer[, $pitch: Integer[, $ignoreIfPlaying: Integer]]]]): Null
Play audio at custom position - available in initializeEngine(), updateEngine()
audio.playAtPosition($id: String, $position: Vector3[, $delay: Integer[, $gain: Integer[, $pitch: Integer[, $ignoreIfPlaying: Integer]]]]): Null

8.3. Engine methods

                                                                                          Table of methods                                                                                          
Get animation computation reduction 1 distance - available in initializeEngine(), updateEngine()
engine.getAnimationComputationReduction1Distance(): Float
Set animation computation reduction 1 distance - available in initializeEngine(), updateEngine()
engine.setAnimationComputationReduction1Distance($animationComputationReduction1Distance: Float): Null
Get animation computation reduction 2 distance - available in initializeEngine(), updateEngine()
engine.getAnimationComputationReduction2Distance(): Float
Set animation computation reduction 2 distance - available in initializeEngine(), updateEngine()
engine.setAnimationComputationReduction2Distance($animationComputationReduction2Distance: Float): Null
Get engine entity id by mouse position - available in initializeEngine(), updateEngine()
engine.getEntityIdByMousePosition($mouseX: Integer, $mouseY: Integer): String
Get engine height - available in initializeEngine(), updateEngine()
engine.getHeight(): Integer
Compute engine screen coordinate by world coordinate - available in initializeEngine(), updateEngine()
engine.computeScreenCoordinateByWorldCoordinate($worldCoodinate: Vector3, &$screenCoordinate: Vector2): Boolean
Get engine width - available in initializeEngine(), updateEngine()
engine.getWidth(): Integer
Compute engine world coordinate by mouse position - available in initializeEngine(), updateEngine()
engine.computeWorldCoordinateByMousePosition($mouseX: Integer, $mouseY: Integer): Vector3
Dump engine entities - available in initializeEngine(), updateEngine()
engine.dumpEntities(): Null
Dump engine shaders - available in initializeEngine(), updateEngine()
engine.dumpShaders(): Null

8.4. Engine camera methods

                                                                                          Table of methods                                                                                          
Get camera horizontal field of view - available in initializeEngine(), updateEngine()
engine.camera.getFovX(): Float
Set camera horizontal field of view - available in initializeEngine(), updateEngine()
engine.camera.setFovX($fovX: Float): Null
Get camera look at - available in initializeEngine(), updateEngine()
engine.camera.getLookAt(): Vector3
Set camera look at - available in initializeEngine(), updateEngine()
engine.camera.setLookAt($lookAt: Vector3): Null
Get camera look from - available in initializeEngine(), updateEngine()
engine.camera.getLookFrom(): Vector3
Set camera look from - available in initializeEngine(), updateEngine()
engine.camera.setLookFrom($lookFrom: Vector3): Null
Get camera up vector - available in initializeEngine(), updateEngine()
engine.camera.getUpVector(): Vector3
Set camera up vector - available in initializeEngine(), updateEngine()
engine.camera.setUpVector($upVector: Vector3): Null
Compute camera up vector - available in initializeEngine(), updateEngine()
engine.camera.computeUpVector($lookFrom: Vector3, $lookAt: Vector3): Vector3

8.5. Engine entity methods

                                                                                          Table of methods                                                                                          
Get engine entity animation - available in initializeEngine(), updateEngine()
engine.entity.getAnimation($entityId: String[, $childEntityId: String]): String
Set engine entity animation - available in initializeEngine(), updateEngine()
engine.entity.setAnimation($entityId: String, $animation: String[, $speed: Float[, $childEntityId: String]]): Null
Get engine entity animation speed - available in initializeEngine(), updateEngine()
engine.entity.setAnimationSpeed($entityId: String, $speed: Float[, $childEntityId: String]): Null
Set engine entity animation speed - available in initializeEngine(), updateEngine()
engine.entity.getAnimationTime($entityId: String[, $childEntityId: String]): Float
Get engine entity additive effect color - available in initializeEngine(), updateEngine()
engine.entity.getEffectColorAdd($entityId: String[, $childEntityId: String]): Vector4
Set engine entity additive effect color - available in initializeEngine(), updateEngine()
engine.entity.setEffectColorAdd($entityId: String, $effectColorAdd: Vector4[, $childEntityId: String]): Null
Get engine entity multiplicative effect color - available in initializeEngine(), updateEngine()
engine.entity.getEffectColorMul($entityId: String[, $childEntityId: String]): Vector4
Set engine entity multiplicative effect color - available in initializeEngine(), updateEngine()
engine.entity.setEffectColorMul($entityId: String, $effectColorMul: Vector4[, $childEntityId: String]): Null
Return if engine entity is enabled - available in initializeEngine(), updateEngine()
engine.entity.isEnabled($entityId: String[, $childEntityId: String]): Boolean
Set engine entity enabled/disabled - available in initializeEngine(), updateEngine()
engine.entity.setEnabled($entityId: String, $enabled: Boolean[, $childEntityId: String]): Null
Get engine entity node transform - available in initializeEngine(), updateEngine()
engine.entity.getNodeTransform($entityId: String, $nodeId: String[, $childEntityId: String]): Transform
Set engine entity node transform - available in initializeEngine(), updateEngine()
engine.entity.setNodeTransform($entityId: String, $nodeId: String, $transform: Transform[, $childEntityId: String]): Null
Unset engine entity node transform - available in initializeEngine(), updateEngine()
engine.entity.unsetNodeTransform($entityId: String, $nodeId: String[, $childEntityId: String]): Null
Get engine entity node transform matrix - available in initializeEngine(), updateEngine()
engine.entity.getNodeTransformMatrix($entityId: String, $nodeId: String[, $childEntityId: String]): Matrix4x4
Set engine entity node transform matrix - available in initializeEngine(), updateEngine()
engine.entity.setNodeTransformMatrix($entityId: String, $nodeId: String, $matrix: Matrix4x4[, $childEntityId: String]): Null
Unset engine entity node transform matrix - available in initializeEngine(), updateEngine()
engine.entity.unsetNodeTransformMatrix($entityId: String, $nodeId: String[, $childEntityId: String]): Null
Return if engine entity has specific overlay animation - available in initializeEngine(), updateEngine()
engine.entity.hasOverlayAnimation($entityId: String, $animation: String[, $childEntityId: String]): Boolean
Return engine entity overlay animation playback time from 0.0 until 1.0 - available in initializeEngine(), updateEngine()
engine.entity.getOverlayAnimationTime($entityId: String, $animation: String[, $childEntityId: String]): Float
Return if engine entity is pickable - available in initializeEngine(), updateEngine()
engine.entity.isPickable($entityId: String[, $childEntityId: String]): Boolean
Set engine entity pickable - available in initializeEngine(), updateEngine()
engine.entity.setPickable($entityId: String, $pickable: Boolean[, $childEntityId: String]): Null
Get engine entity transform - available in initializeEngine(), updateEngine()
engine.entity.getTransform($entityId: String[, $childEntityId: String]): Transform
Set engine entity transform - available in initializeEngine(), updateEngine()
engine.entity.setTransform($entityId: String, $transform: Transform[, $childEntityId: String]): Null
Add engine entity overlay animation - available in initializeEngine(), updateEngine()
engine.entity.addOverlayAnimation($entityId: String, $animation: String[, $childEntityId: String]): Null
Emit engine entity particles - available in initializeEngine(), updateEngine()
engine.entity.emitParticles($entityId: String[, $childEntityId: String]): Integer
Remove finished overlay animations - available in initializeEngine(), updateEngine()
engine.entity.removeFinishedOverlayAnimations($entityId: String[, $childEntityId: String]): Null
Remove specific overlay animation - available in initializeEngine(), updateEngine()
engine.entity.removeOverlayAnimation($entityId: String, $animation: String[, $childEntityId: String]): Null
Remove overlay animations - available in initializeEngine(), updateEngine()
engine.entity.removeOverlayAnimations($entityId: String[, $childEntityId: String]): Null

8.6. Engine timing methods

                                                                                          Table of methods                                                                                          
Get engine timing avarage FPS - available in initializeEngine(), updateEngine()
engine.timing.getAvarageFPS(): Float
Get engine timing frame delta time in milliseconds - available in initializeEngine(), updateEngine()
engine.timing.getDeltaTime(): Integer
Get engine timing frame delta time in seconds - available in initializeEngine(), updateEngine()
engine.timing.getDeltaTimeSeconds(): Float

8.7. Keyboard input methods

                                                                                          Table of methods                                                                                          
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 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

8.8. Mouse input methods

                                                                                          Table of methods                                                                                          
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

8.9. Logic methods

                                                                                          Table of methods                                                                                          
Returns if logic has callable function
logic.has($logicId: String, $callable: String): Boolean
Get hierarchy id - available in initializeEngine(), updateEngine(), initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
logic.getHierarchyId(): String
Get hierarchy parent id - available in initializeEngine(), updateEngine(), initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
logic.getHierarchyParentId(): String
Get logic id - available in initializeEngine(), updateEngine(), initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
logic.getId(): String
Get logic ids of all logics within application context - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
logic.getLogicIds(): Array
Call specific logic callable function
logic.call($logicId: String, $callable: String, ...): Mixed

8.10. Logic signal methods

                                                                                          Table of methods                                                                                          
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(): Null
Send signal - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
logic.signal.send($logicId: String, $signal: String, ...): Null

8.11. PathFinding methods

                                                                                          Table of methods                                                                                          
Pathfinding idle state integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
pathfinding.STATE_IDLE(): Integer
Pathfinding computing state integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
pathfinding.STATE_PATHFINDING(): Integer
Pathfinding failed state integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
pathfinding.STATE_PATHFINDING_FAILED(): Integer
Pathfinding computing other pathfinding integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
pathfinding.STATE_PATHFINDING_OTHER(): Integer
Pathfinding success state integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
pathfinding.STATE_PATHFINDING_SUCCESS(): Integer
Pathfinding try/lock failed integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
pathfinding.STATE_TRYLOCK_FAILED(): Integer
Issue pathfinding - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
pathfinding.findPath($logicId: String, $startPosition: Vector3, $endPosition: Vector3, &$path: Array): Integer

8.12. Scene methods

                                                                                          Table of methods                                                                                          
Get scene depth
scene.getDepth(): Float
Get scene height
scene.getHeight(): Float
Get scene width
scene.getWidth(): Float

8.13. SceneConnector methods

                                                                                          Table of methods                                                                                          
Attach prototype to the logic hierarchy - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
sceneconnector.attachPrototype($pathName: String, $fileName: String, $id: String, $attachNodeId: String, $transform: Transform[, $parentId: String]): Null
Spawn prototype in scene - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
sceneconnector.spawnPrototype($pathName: String, $fileName: String, $id: String, $transform: Transform[, $hierarchyId: String[, $hierarchyParentId: String]]): Null

8.14. Physics world methods

                                                                                          Table of methods                                                                                          
Determine height at specific position in physics world - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
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 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.doCollide($bodyId1: String, $bodyId2: String): Boolean
Compute ray casting in physics world - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.doRayCasting($collisionTypeIds: Integer, $start: Vector3, $end: Vector3, &$hitPoint: Vector3[, &$bodyId: String[, $actorId: String]]): Boolean
Determine collision of specific body in physics world - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.doesCollideWith($collisionTypeIds: Integer, $bodyId: String): Array

8.15. Physics world body methods

                                                                                          Table of methods                                                                                          
Get physics world entity angular damping - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getAngularDamping($bodyId: String): Float
Set physics world entity angular damping - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setAngularDamping($bodyId: String, $angularDamping: Float): Null
Get physics world entity angular velocity - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getAngularVelocity($bodyId: String): Vector3
Set physics world entity angular velocity - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setAngularVelocity($bodyId: String, $angularVelocity: Vector3): Null
Returns physics world collision type id 10 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_10(): Integer
Returns physics world collision type id 11 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_11(): Integer
Returns physics world collision type id 12 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_12(): Integer
Returns physics world collision type id 13 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_13(): Integer
Returns physics world collision type id 14 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_14(): Integer
Returns physics world collision type id 15 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_15(): Integer
Returns physics world collision type id 16 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_16(): Integer
Returns physics world collision type id 3 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_3(): Integer
Returns physics world collision type id 4 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_4(): Integer
Returns physics world collision type id 5 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_5(): Integer
Returns physics world collision type id 6 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_6(): Integer
Returns physics world collision type id 7 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_7(): Integer
Returns physics world collision type id 8 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_8(): Integer
Returns physics world collision type id 9 - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_9(): Integer
Returns all physics world collision type ids - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_ALL(): Integer
Returns dynamic physics world collision type id - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_DYNAMIC(): Integer
Returns static physics world collision type id - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.COLLISION_TYPEID_STATIC(): Integer
Get Physics world entity own collision type id - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getCollisionTypeId($bodyId: String): Integer
Set Physics world entity own collision type id - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setCollisionTypeId($bodyId: String, $collisionTypeId: Integer): Null
Get Physics world entity enabled collision type ids - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getCollisionTypeIds($bodyId: String): Integer
Set Physics world entity enabled collision type ids - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setCollisionTypeIds($bodyId: String, $collisionTypeIds: Integer): Null
Returns if physics world entity is enabled - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.isEnabled($bodyId: String): Boolean
Set physics world entity enabled/disabled - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setEnabled($bodyId: String, $enabled: Boolean): Null
Get physics world entity linear damping - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getLinearDamping($bodyId: String): Float
Set physics world entity linear damping - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setLinearDamping($bodyId: String, $linearDamping: Float): Null
Get physics world entity linear velocity - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getLinearVelocity($bodyId: String): Vector3
Set physics world entity linear velocity - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setLinearVelocity($bodyId: String, $linearVelocity: Vector3): Null
Returns physics world dynamic collision body type integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.TYPE_COLLISION_DYNAMIC(): Integer
Returns physics world static collision body type integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.TYPE_COLLISION_STATIC(): Integer
Returns physics world dynamic rigid body type integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.TYPE_DYNAMIC(): Integer
Returns physics world static rigid body type integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.TYPE_STATIC(): Integer
Get physics world entity transform - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getTransform($bodyId: String): Transform
Set physics world entity transform - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.setTransform($bodyId: String, $transform: Transform): Null
Get physics world entity body type integer code - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.getType($bodyId: String): Integer
Add force to physics world entity - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.addForce($bodyId: String, $force: Vector3[, $origin: Vector3]): Null
Add torque to physics world entity - available in initializeLogic(), updateLogic(), onLogicAdded(), onLogicsProcessed()
world.body.addTorque($bodyId: String, $torque: Vector3): Null

9. MiniScript GUI methods

The boilerplate template code for a MiniScript GUI logic looks like: gui_script_template.tscript

9.1. Element node condition methods

                                                                                          Table of 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): Null
Set array of enabled GUI element node conditions
gui.elementnode.conditions.setAll($elementNodeId: String, $conditions: Array): Null
Add enabled GUI element node condition
gui.elementnode.conditions.add($elementNodeId: String, $condition: String): Null
Remove enabled GUI element node condition
gui.elementnode.conditions.remove($elementNodeId: String, $condition: String): Null
Remove all enabled GUI element node conditions
gui.elementnode.conditions.removeAll($elementNodeId: String): Null

9.2. Event methods

                                                                                          Table of methods                                                                                          
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

9.3. Image node methods

                                                                                          Table of methods                                                                                          
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): Null

9.4. Node controller methods

                                                                                          Table of methods                                                                                          
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): Null

9.5. Parent node methods

                                                                                          Table of methods                                                                                          
Add sub nodes using XML to GUI parent node
gui.parentnode.addSubNodes($parentNodeId: String, $xml: String[, $resetScrollOffsets: Boolean]): Null
Clear sub nodes of GUI parent node
gui.parentnode.clearSubNodes($parentNodeId: String): Null
Replace sub nodes using XML of GUI parent node
gui.parentnode.replaceSubNodes($parentNodeId: String, $xml: String[, $resetScrollOffsets: Boolean]): Null

9.6. Screen methods

                                                                                          Table of methods                                                                                          
Return if GUI screen is enabled
gui.screen.isEnabled($screenId: String): Boolean
Set GUI screen enabled/disabled
gui.screen.setEnabled($screenId: String, $enabled: Boolean): Null
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]]): Null
Pop current screen from screen stack
gui.screen.pop(): Null
Push screen to current screen stack
gui.screen.push($fileName: String[, $variables: Map[, $arguments: Mixed]]): Null

9.7. Screen node methods

                                                                                          Table of methods                                                                                          
Get current screen node Id
gui.screennode.getId(): String

9.8. Text node methods

                                                                                          Table of methods                                                                                          
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): Null

9.9. Video node methods

                                                                                          Table of methods                                                                                          
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): Null

9.10. Keyboard input methods

                                                                                          Table of methods                                                                                          
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 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

9.11. Mouse input methods

                                                                                          Table of methods                                                                                          
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

9.12. Logic methods

                                                                                          Table of methods                                                                                          
Returns if logic has callable function
logic.has($logicId: String, $callable: String): Boolean
Call specific logic callable function
logic.call($logicId: String, $callable: String, ...): Mixed

9.13. Logic signal methods

                                                                                          Table of methods                                                                                          
Send signal
logic.signal.send($logicId: String, $signal: String, ...): Null

10. 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
++ postfixIncrement(&$variable: Integer): Integer
++ prefixIncrement(&$variable: Integer): Integer
- sub($a: Mixed, $b: Mixed): Mixed
-- postfixDecrement(&$variable: Integer): Integer
-- 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