Mantis Command Reference
Mantis Language · Complete Syntax & Command Cheat SheetEvery command currently supported in Mantis, grouped by functional category with links to dedicated reference pages.
Core commands
| Command | Syntax | What It Does | Dedicated Guide |
|---|---|---|---|
STRING | STRING text | Types text exactly as written. | STRING Guide |
STRINGLN | STRINGLN text | Types text, then presses Enter. | STRINGLN Guide |
FAST_STRING (Pro) | FAST_STRING text | Types text via batched HID codes at maximum speed. | FAST_STRING Guide |
STRING_BLOCK | STRING_BLOCK ... END_STRING | Types multiple lines collapsed into one. | Strings Guide |
DELAY | DELAY ms | Pauses the script. | DELAY Guide |
SET_DELAY | SET_DELAY ms | Sets fixed per-keystroke pacing. | SET_DELAY Guide |
SET_SPEED | SET_SPEED speed | Sets per-keystroke pacing via preset (e.g. $Random, $Human). | SET_SPEED Guide |
DEFINE | DEFINE name type value | Declares a compile-time constant. | DEFINE Guide |
REM | REM comment | Comment — stripped during compilation. | REM Guide |
LOOP | LOOP [count] ... END_LOOP | Repeats a block infinitely or a finite number of times. | LOOP Guide |
BREAK | BREAK | Exits the current loop early. | LOOP Guide |
CONTINUE | CONTINUE | Skips to the next iteration of the loop. | LOOP Guide |
IF / ELSE | IF cond THEN ... END_IF | Branching based on a condition (BUTTON_PRESSED, TRUE). | IF & ELSE Guide |
LED_ON / LED_OFF | LED_ON / LED_OFF | Scriptable onboard status LED control. | LED Guide |
WAIT_FOR_BUTTON_PRESS | WAIT_FOR_BUTTON_PRESS | Pauses until the onboard button is pressed. | Button Guide |
BUTTON_DEF | BUTTON_DEF ... END_BUTTON | Defines an on-press handler block. | BUTTON_DEF Guide |
FUNCTION | FUNCTION name() ... END_FUNCTION | Defines a reusable named block. | FUNCTION Guide |
| Function call | name() | Runs a previously defined function. | FUNCTION Guide |
ATTACKMODE | ATTACKMODE mode | Configures USB CDC/HID/OFF modes. | ATTACKMODE Guide |
INJECT_MOD | INJECT_MOD modifier | Directly injects raw modifier bitmasks. | INJECT_MOD Guide |
Examples
Related commands are grouped into one runnable example where it makes sense; standalone commands get their own.
STRING / STRINGLN / FAST_STRING / STRING_BLOCK
hello.mantis
1STRING Hello2STRINGLN Hello3FAST_STRING Hello4STRING_BLOCK5This block spans three source lines6but types as one.7END_STRINGDELAY / SET_DELAY / SET_SPEED
hello.mantis
1DELAY 5002SET_DELAY 303SET_SPEED $Human4SET_SPEED $RandomDEFINE
hello.mantis
1DEFINE #NAME STR Karvi2STRINGLN Hello #NAMELOOP / BREAK / CONTINUE
hello.mantis
1LOOP 102IF BUTTON_PRESSED THEN3 BREAK4END_IF5STRING .6DELAY 3007END_LOOPIF / ELSE
hello.mantis
1IF BUTTON_PRESSED THEN2 STRINGLN Button is pressed!3ELSE4 STRINGLN Button is released.5END_IFLED_ON / LED_OFF
hello.mantis
1LED_ON2DELAY 3003LED_OFFWAIT_FOR_BUTTON_PRESS
hello.mantis
1STRING Waiting...2WAIT_FOR_BUTTON_PRESS3STRINGLN Button pressed, continuing.FUNCTION … END_FUNCTION / name()
hello.mantis
1FUNCTION greet()2STRINGLN Hello from a function!3END_FUNCTION45greet()6greet()BUTTON_DEF … END_BUTTON
hello.mantis
1BUTTON_DEF2STRINGLN You pressed the button!3END_BUTTONATTACKMODE / INJECT_MOD
hello.mantis
1ATTACKMODE HID2INJECT_MOD CTRL ALTKeys & modifiers
See Keyboard commands for the full key and modifier tables and examples.
Pro / roadmap
Reserved for a future release — not available in the base Mantis firmware today:
| Name | Note |
|---|---|
| Serial / CDC scripting | Planned commands for scripting the device’s serial (USB CDC) channel directly. |
Last updated on