Syntax ====== +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | Syntax | Notes | +=========================================================================+========================================================================================+ | ``var varName := `` | Define a new variable | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``obj `` | Define a new scoreboard objective | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``sobj `` | Set the value of an objective for a given target (eg. ``@a`` or ``PlayerName``) | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``var varName `` | Update the value of an existing variable | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``tvar varName`` | Used to test variables in ``if`` commands (eg. ``execute if tvar varName matches 1``) | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``func name`` | Define a function. Generates a new mcfunction file | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``!def macro($arg1, $arg2)`` | Define a macro. See the :ref:`macros page ` for more information | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``?macro("arg1", "arg2")`` | Calls a macro. See the :ref:`macros page ` for more information | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``!end`` | Ends a macro definition. See the :ref:`macros page ` | | | for more information | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``!!`` | Tells the compiler to directly copy the following text on the line as-is | | | (eg. ``!! abcd`` -> ``abcd``) | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``call `` | Call a function. Can infer namespace based on directory (see function calling example) | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``runif `` | Starts an if statement | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``else`` | Runs if an if statement's condition was not true | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``while `` | Create a while loop. Condition should be something passable to ``execute if`` | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``end`` | Close a function, while loop, or if statement | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``sbop`` | Shorthand for ``scoreboard players operation`` | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``gvar varName`` | Can be used with a scoreboard operation as such: ``sbop gvar var1 += gvar var2`` | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``delvar varName`` OR ``delobj objName`` | Delete a variable or objective. Can be used interchangeably | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``%`` | Used to escape keywords (eg. ``say %call a function`` -> ``say call a function``) | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | Assignment Operators | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``+=`` | Add to a variable | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``-=`` | Subtract from a variable | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ | ``=`` | Set the value of a variable | +-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+