This repo contains documentation and specifications for MACS (Mechanized Assault Commanders) build-in scripting system
This specification explains about MACS Touch embedded scripting API. Using this API you can write your own scenarios.
Facebook community: https://www.facebook.com/groups/1420889268172393/
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 tutorial0Runtime.lua
Runtime script is a script that contains logic that will be executed during the match, on top of running game. Game is constantly calling script event handler on each game event and allows script to handle those events by executing 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.
To start creating your scenario you should open test match script which is located in game resources folder: Resources/Scripts/testMatch.lua:
You can open it with any text editor, I would recommend you Visual Studio Code, Atom, Sublime Text or Notepad++ because they have option to highlight script syntax, it is very useful.
In order to run the script, start the game, go LOCAL GAME and press small {>}
button on the top-left corner of the screen. Game will start a local game with the content of testMatch.lua
.
For details about initializion script please refer to Guide for Initialization script.
After you done with your scenario and want to show it to community you should do following steps:
Now new scenario should appear for you in game.
On scenarios page (navigate to Game -> Scenarios https://macsgame.com/game/scenarios.html ) you can see all available scenarios.
Choose any scenario created by other member (for example: https://macsgame.com/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 MACS engine. 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.
Represents player
GameMatchPlayer API description
Represents unit
Built-in event system allow you to track and handle some game events.
Quest system is based on handling events.