MacroMod Documentation & API Guide
Learn how to build powerful macros, automate gameplay loops, configure event threshold triggers, and design custom HUD scripts.
1. Macro Syntax Basics
MacroMod supports two execution formats: Inline Macros and Script Files.
Inline Macros
Inline macros are single-line instruction sets bound directly to a keyboard trigger or
event inside the Configuration GUI. Chained actions are separated by a vertical bar
(|).
# Simple inline look and walk combo (using name alias)
{LOOK 90 0} | {KEYDOWN forward} | {WAIT 100} | {KEYUP forward}
Script Files (.mcm)
Script files (ending in .mcm) are written sequentially line-by-line under
the Scripts tab or in
.minecraft/config/macromod/scripts/. Chaining vertical bars
(|) are not used in script files.
# Walk forward and jump
{LOOK 90 0}
{KEYDOWN 87}
{WAIT 40}
{KEY 32}
{WAIT 40}
{KEYUP 87}
2. Built-in Special Actions
Special client actions are enclosed inside curly braces ({}). They
simulate hardware inputs or instruct the macro execution flow:
| Action Command | Description | Usage Example |
|---|---|---|
{STASHALL} |
Automatically deposits main player inventory items into open container screens while protecting hotbar tools (pickaxes & shovels). | {STASHALL} |
{CHAT msg} |
Dispatches a chat message or server command with color section sign
translation (e.g., &a → §a).
|
{CHAT &a[Macro] Auto-stashing items...} |
{READFILE file arrayVar} /
{ARRAYSIZE arrayVar targetVar} /
{GETARRAY arrayVar index targetVar}
|
Reads lines from a text file into an array variable, gets array length, or
indexes specific lines in .mcm scripts.
|
{READFILE "targets.txt" targets} |
{SLOTCLICK slot [button] [mode]} /
{SHIFTCLICK slot} / {CTRLSHIFTCLICK slot} /
{QUICKMOVE slot} / {QUICKMOVEALL slot} /
{CONTAINERCLICK slot button mode}
|
Granular container and slot manipulation actions for inventory automation. | {QUICKMOVEALL 9} or {SHIFTCLICK 0} |
{SLOT 1..9} / {HOTBAR 1..9} |
Switches selected hotbar slot (1 to 9 mapped to 0..8 indices) and dispatches
ServerboundSetCarriedItemPacket.
|
{SLOT 1} (Selects hotbar slot 1) |
{CLOSESCREEN} |
Invokes Screen.onClose() to properly dispatch container close
packets, preventing screen overlay lockups.
|
{CLOSESCREEN} |
{WAIT ticks} / {WAIT min max} /
{WAITRANDOM min max}
|
Pauses macro execution for a fixed tick duration, or waits a random tick duration in min/max range. | {WAIT 40} or {WAITRANDOM 20 50} |
{LOOK yaw pitch} |
Instantly turns player view to target rotation angles. | {LOOK 180 0} (Looks West) |
{LOOKRANGE minYaw maxYaw minPitch maxPitch} |
Faces a random direction bounded by min/max angle boundaries. | {LOOKRANGE 87 93 -3 3} |
{LOOKRANDOM centerYaw centerPitch yawSpread pitchSpread} |
Faces a random direction centered at target angle with ±variance spread.
(Aliases: {LOOKVARIANCE}, {LOOKSPREAD},
{LOOKOFFSET}).
|
{LOOKRANDOM 90 0 3 3} |
{LEFTCLICK} / {ATTACK} / {LMB} |
Triggers a single left-click attack / break action tap. | {LEFTCLICK} or {ATTACK} |
{RIGHTCLICK} / {USE} / {RMB} |
Triggers a single right-click / item-use action tap. | {RIGHTCLICK} or {USE} |
{KEYDOWN key} |
Simulates holding down a key or mouse button. Accepts GLFW keycodes, key
names, mouse codes (-100), or game action aliases
(attack, use, jump, sneak,
sprint, forward, back,
left, right).
|
{KEYDOWN attack} or {KEYDOWN -100} |
{KEYUP key} |
Simulates releasing a held key or mouse button. Supports the same aliases and
codes as {KEYDOWN}.
|
{KEYUP attack} or {KEYUP -100} |
{KEY key} |
Simulates a quick tap (press and release) of a key or action. Supports keycodes, names, and action aliases. | {KEY space} or {KEY 32} (Jumps) |
{OPENSCREEN} |
Opens the Macro Configuration GUI dashboard. | {OPENSCREEN} |
{OPENOVERLAY} |
Opens the transparent gameplay buttons HUD overlay screen. | {OPENOVERLAY} |
{ECHO msg} |
Prints a private local system message in your chat console. | {ECHO Low Durability!} |
{LOOKAT x y z} |
Turns player camera to face target 3D world coordinates. | {LOOKAT 100 64 -200} |
{DROP slot} / {DROPALL} |
Drops item in specified slot or drops entire inventory. | {DROP 0} / {DROPALL} |
{SNEAK} / {UNSNEAK} |
Toggles sneaking / crouching state on or off. | {SNEAK} |
{SPRINT} / {UNSPRINT} |
Toggles sprinting state on or off. | {SPRINT} |
{JUMP} |
Simulates a single jump action. | {JUMP} |
{DISCONNECT} / {LOGOUT} |
Disconnects from the current server or world. | {DISCONNECT} |
{CLEARCHAT} |
Clears the client-side chat HUD console. | {CLEARCHAT} |
{STOP} / {STOPALL} |
Emergency Kill Switch. Immediately halts all running scripts and releases all held keys. | {STOPALL} |
{CALL name} |
Invokes a multi-line script file from the script library. | {CALL AutoStash} |
{INVENTORYGETSLOT item_id varName} |
Finds inventory slot containing item_id and stores index into a
variable.
|
{INVENTORYGETSLOT minecraft:diamond_pickaxe pickSlot} |
{GETHELDITEM varName} |
Stores item ID of currently held main-hand item into a variable. | {GETHELDITEM currentItem} |
{GETCONTAINERTITLE varName} |
Stores title of currently open container screen into a variable. | {GETCONTAINERTITLE openTitle} |
{SWAPSLOT fromSlot toSlot} |
Swaps items between two inventory slot indexes. | {SWAPSLOT 0 36} |
{WAITUNTIL condition [timeout_ticks]} |
Parks interpreter execution until condition evaluates to true or optional timeout elapses. | {WAITUNTIL $containeropen == 1 100} |
3. Input Placeholders
You can pause macro execution to request input from the user before executing the command:
-
$$?: Opens a generic text entry box./pv $$?
-
$$[Prompt Label]: Opens a text input box with a custom descriptive prompt label./pv $$[Vault Number] # Displays "Vault Number:" above the field
4. Script Control Flow & Advanced Logic
Write advanced logic statements within .mcm script library files
PREMIUM FEATURE:
While Loops
while $health < 12 execute "/heal" delay 40 endwhile
For Loops
for i 0 8
execute "{SLOT $i}"
delay 10
endfor
Conditionals & String Comparisons
if $dimension == "minecraft:the_nether"
execute "{ECHO Caution: In Nether!}"
else
execute "{ECHO Overworld location: $xpos, $zpos}"
endif
5. Read-Only Player & World Variables
Read-only player and world variables can be queried inside script conditions or
printed using {ECHO}:
| Variable | Type | Description |
|---|---|---|
$health |
Float | Current player health (out of 20 by default). |
$maxhealth |
Float | Maximum player health capacity. |
$hunger |
Integer | Current hunger saturation level (0-20). |
$durability |
Integer / % | Remaining durability percent of the currently held item. |
$offhanddurability, $helmetdurability,
$chestdurability, $leggingsdurability,
$bootsdurability
|
Integer / % | Durability percent of offhand item and equipped armor slots. |
$hasgui, $containeropen |
Boolean (0/1) | Returns 1 if a screen or container inventory GUI is currently open. |
$targettype |
Integer | Type of object under crosshairs (0=Air/Miss, 1=Block, 2=Entity). |
$targetdist, $targetx, $targety,
$targetz
|
Double | Distance and world coordinates of targeted block/entity. |
$invfull |
Boolean (0/1) | Returns 1 if player's main inventory has no free slots. |
$xpos, $ypos, $zpos |
Double | Player coordinate location values in the world. |
$speed |
Double | Current horizontal player movement speed. |
$isburning, $onfire |
Boolean (0/1) | Returns 1 if player is currently on fire / burning. |
$isswimming |
Boolean (0/1) | Returns 1 if player is currently swimming. |
$eyeheight |
Double | Player's current camera eye height coordinate offset. |
$random / $rand |
Float | Returns a random floating-point number between 0.0 and 1.0. |
$dimension, $biome, $server,
$fps, $ping
|
String / Int | Current dimension, biome name, server IP, FPS counter, and ping latency. |
6. GLFW Keycodes & Game Action Aliases
Use keycode integers, key name strings, or game action aliases inside
{KEY}, {KEYDOWN}, and {KEYUP} actions:
| Key | Code | Key | Code |
|---|---|---|---|
| A - Z | 65 - 90 | 0 - 9 | 48 - 57 |
| Space | 32 | Enter | 257 |
| Escape | 256 | Tab | 258 |
| Backspace | 259 | Grave (`) | 96 |
| L-Shift | 340 | L-Ctrl | 341 |
| L-Alt | 342 | R-Shift | 344 |
| L-Click | -100 | R-Click | -101 / -99 |
| M-Click | -102 / -98 | F1 - F12 | 290 - 301 |
Mouse Buttons & Game Action Aliases
| Target / Action | Code(s) / Aliases | Description |
|---|---|---|
| Left Click / Attack |
-100, LMB, ATTACK,
LEFTCLICK
|
Hold or release Left Click (Attack / Mine block). |
| Right Click / Use |
-101, -99, RMB, USE,
RIGHTCLICK
|
Hold or release Right Click (Use / Place block / Eat). |
| Middle Click / Pick |
-102, -98, MMB, PICK,
MIDDLECLICK
|
Hold or release Middle Click (Pick block). |
| Forward / Back / Left / Right |
FORWARD, BACK, LEFT, RIGHT
|
Movement directions mapped to player keys. |
| Jump / Sneak / Sprint | JUMP, SNEAK, SPRINT |
Player action aliases. |
7. Container & Inventory Slot Index Map
Use these integer slot IDs with {SLOTCLICK slot [button] [type]},
{SHIFTCLICK slot}, and {ALLCLICK slot} actions:
Player Inventory Slot Map (46 Slots)
+-------------------------------------------------------------+ | CRAFTING | | [ 1 ] [ 2 ] | | [ 3 ] [ 4 ] ---> [ 0 ] Result | +-------------------------------------------------------------+ | ARMOR | | [ 5 ] Helmet | | [ 6 ] Chestplate | | [ 7 ] Leggings | | [ 8 ] Boots [ 45 ] Offhand | +-------------------------------------------------------------+ | MAIN INVENTORY | | [ 9 ] [10] [11] [12] [13] [14] [15] [16] [17] | | [18] [19] [20] [21] [22] [23] [24] [25] [26] | | [27] [28] [29] [30] [31] [32] [33] [34] [35] | +-------------------------------------------------------------+ | HOTBAR | | [36] [37] [38] [39] [40] [41] [42] [43] [44] | +-------------------------------------------------------------+
| Container Type | Container Content Slots | Player Main Inventory | Player Hotbar |
|---|---|---|---|
| Single Chest / Shulker Box (27 slots) | 0 to 26 |
27 to 53 |
54 to 62 |
| Double Chest (54 slots) | 0 to 53 |
54 to 80 |
81 to 89 |
8. Companion Server Plugin (macromod-server)
MacroMod is designed as a player-first client-side mod. Server administrators can manage or restrict macro features on Paper, Folia, Velocity, or BungeeCord servers using our companion plugin:
# MacroModServer Policy Configuration (config.yml)
version: 1
allowMovement: true # Allow movement actions ({KEYDOWN W}, etc.)
allowLook: true # Allow camera rotation actions ({LOOK}, {LOOKAT})
allowInventoryAutomation: true # Allow slot clicking ({SLOTCLICK}, {SHIFTCLICK})
allowScriptFiles: true # Allow executing multi-line .mcm script library files
allowLooping: true # Allow while and for loop statements
maxLoopIterations: 1000 # Max loop iteration cap
chatRateLimitMs: 250 # Delay (ms) enforced between chat messages