This repo contains documentation and specifications for M.A.X. Touch build-in scripting system
Table of Contents
- API Specification
- Event System
- Quest System
This specification explains about M.A.X. Touch embedded scripting API. Using this API you can write your own scenarios.
Facebook community: https://www.facebook.com/groups/1420889268172393/
- In order to see coordinates, open options.json, find displayConsole varable and set it to true. In addition set fullscreen to false. Now console will print cell coordinates you click on.
- In order to find unit types, open Units/originalUniset.json, refer to _type value. For example, Heavy vehicle plant is hvplant.
- In order to find available maps refer to loadedRemoteMaps.json in Saves folder. You should put desired map's file property + .wrl, for example 224x2246.wrl to start on Revelation map.
Initialize script is a script that will initialize match. It should be named initScript.lua and should be located in root directory of scenario zip arhive.
This script will be executed during game load in order to initialize the game.
For details about initializion script please refer to Guide for Initialization script.
This is still work in progres and not supported for scenarios. You can play with tutorial0.lua
Runtime script allow you to write logic that will be executed during the match. Game call script event handler and script can execute some logic at this moment.
For details about runtime script please refer to Guide for Runitme script.
Initialization script and Runtime script will be running in main thread.
Initialization script and Runtime script have different contexts so values defined on Initialization script will not be available in Runtime script.
Please note that some APIs are available for Initialization script and not available for Runtime script, and vise versa.
Uploading and using scenarios
After you done with your scenario and want to show it to community you should do following steps:
- rename initialization script file (testMatch.lua file) into initScript.lua
- zip this file into arhive. Archive should contains this file in a root folder.
- go to website https://maxsrv.automania.net/#
- naviage to MY -> My Scenarios: https://maxsrv.automania.net/my/scenarios.html
- Choose Create New https://maxsrv.automania.net/my/edit-scenario.html
- Press Choose File button and select your zip archive
- Website will parse your script file and show its data. Press Add
- Now your script is uploaded. Press Ready and Save to show it in the game.
Now new scenario should appear for you in game.
On scenarios page (navigate to Game -> Scenarios https://maxsrv.automania.net/game/scenarios.html ) you can see all available scenarios.
Choose any scenario created by other member (for example: https://maxsrv.automania.net/game/scenario/3.html) and press Add to my list in order to see it in game.
This section contains information about objects and its APIs that hosting application exposes to lua side.
Structures are passed to script by value with transferring ownership into lua.
Objects will be passed by pointer and will stay owned/managed by M.A.X. Do not retain them for a long time - basically script will not know when object will be deleted.
Represents top-level game state. Game object is responsible for working with UI and user input: windows, visual pointers, UI blocks and so on.
Represents a map. Map contains infomation about
Represents match. Match contains all players and some extra information about its state.
Built-in event system allow you to track and handle some game events.
Quest system is based on handling events.
Current version: 10.1