Skip to content

Latest commit

 

History

History
251 lines (216 loc) · 31.3 KB

README-MiniScript.md

File metadata and controls

251 lines (216 loc) · 31.3 KB

LOGO

This is the documentation of MiniScript language within A-GUI. 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. A-GUI MinitScript

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

2.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

2.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

2.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

2.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

2.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

2.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

2.7. Screen node methods

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

2.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

2.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

2.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

2.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

3. Other information

3.1. Links