Command Input System
Overview
The .cmd file defines how player inputs are translated into character actions. It maps button sequences and joystick motions to named commands, then uses Statedef -1 to detect those commands and trigger state transitions.
.cmd File Structure
A .cmd file has four sections:
- •
[Remap]-- Button remapping - •
[Defaults]-- Default timing values - •
[Command]blocks -- Input definitions - •
[Statedef -1]-- Command detection logic
Input Notation
Directional Inputs
U = Up UF = Up-Forward UB = Up-Back F = Forward B = Back D = Down DF = Down-Forward DB = Down-Back
Important: F (Forward) and B (Back) are RELATIVE to the character's facing direction. If facing right, F = right. If facing left, F = left. The engine handles this automatically.
Button Inputs
x = Light Punch a = Light Kick y = Medium Punch b = Medium Kick z = Heavy Punch c = Heavy Kick s = Start button
Input Modifiers
~ = Release (button must be released) ~30 = Hold for 30 ticks then release (charge moves) $ = Direction held (4-way only: $F, $B, $U, $D) / = Hold button while pressing next input > = Must be pressed immediately after previous (no other inputs between) + = Press simultaneously (x+y = press x and y together)
Motion Examples
Quarter Circle Forward (QCF): ~D, DF, F, x
- •Release D, then through DF to F, then press x
- •The
~on D means D must be released (was previously held)
Dragon Punch (DP / Forward-Down-DownForward): ~F, D, DF, x
- •Classic "Z-motion" or Shoryuken input
Half Circle Back (HCB): ~F, DF, D, DB, B, x
- •Roll stick from forward to back
Full Circle (360): ~F, DF, D, DB, B, UB, U, UF, x
- •Grappler command grab input
Charge Back-Forward: ~30B, F, x
- •Hold back for 30 ticks (~0.5 seconds), then press forward + button
Charge Down-Up: ~30D, U, x
- •Hold down for 30 ticks, then press up + button
Double Tap Forward (Dash): F, F
- •Press forward twice quickly
Button Combination: x+y
- •Press both simultaneously
Button Release: ~x
- •Release x button (for negative edge)
Command Block Format
[Command] name = "QCF_x" ; Name referenced in Statedef -1 command = ~D, DF, F, x ; The actual input sequence time = 20 ; Ticks allowed to complete (default from [Defaults]) buffer.time = 1 ; Input buffer (default from [Defaults])
Command Timing
- •
time: Total ticks allowed to complete the entire motion (default: 15) - •
buffer.time: Ticks the completed command stays active (default: 1) - •Higher
time= more lenient input (easier for beginners) - •Standard values: Simple moves 15, Specials 20, Supers 30, 360 motions 40
Statedef -1: Command Detection
Statedef -1 runs EVERY tick and checks which commands are active, then transitions to the appropriate state.
Priority Order (CRITICAL)
Commands must be ordered from MOST COMPLEX to LEAST COMPLEX:
- •Super moves (most complex inputs, highest priority)
- •Special moves (motion inputs)
- •Command normals (direction + button)
- •Normal attacks (single button)
- •Movement (directional only)
This prevents simple inputs from "eating" complex ones. If you check light punch (just x) before dragon punch (F,D,DF,x), pressing x during the dragon punch motion would trigger light punch instead.
Statedef -1 Pattern
[Statedef -1] ; --- SUPER MOVES (Level 3) --- [State -1, Super Fireball] type = ChangeState value = 3000 triggerall = command = "QCF_QCF_x" ; Double QCF + x triggerall = power >= 1000 ; Requires 1 bar triggerall = statetype != A ; Not airborne trigger1 = ctrl ; Has control trigger2 = stateno = 200 && movecontact ; Cancel from light punch ; --- SPECIAL MOVES --- [State -1, Dragon Punch] type = ChangeState value = 1000 triggerall = command = "DP_x" triggerall = statetype != A trigger1 = ctrl trigger2 = stateno = [200, 250] && movecontact ; Cancel from normals [State -1, Fireball] type = ChangeState value = 1100 triggerall = command = "QCF_x" triggerall = statetype != A trigger1 = ctrl trigger2 = stateno = [200, 250] && movecontact ; --- NORMAL ATTACKS --- [State -1, Light Punch] type = ChangeState value = 200 triggerall = command = "x" triggerall = statetype = S ; Standing trigger1 = ctrl [State -1, Crouch Light Punch] type = ChangeState value = 400 triggerall = command = "x" triggerall = statetype = C ; Crouching trigger1 = ctrl
Cancel System
Cancels allow interrupting one move into another on hit/block:
; Cancel from light into medium trigger2 = stateno = 200 && movecontact ; Cancel from any normal into special trigger2 = stateno = [200, 299] && movecontact ; Cancel from special into super trigger2 = stateno = [1000, 1999] && movehit
Common Command Definitions
Standard 6-Button Fighter Commands
; Quarter Circle Forward (Fireball) [Command] name = "QCF_x" command = ~D, DF, F, x time = 20 [Command] name = "QCF_y" command = ~D, DF, F, y time = 20 [Command] name = "QCF_z" command = ~D, DF, F, z time = 20 ; Dragon Punch (Shoryuken) [Command] name = "DP_x" command = ~F, D, DF, x time = 20 [Command] name = "DP_y" command = ~F, D, DF, y time = 20 ; Half Circle Back (Grab/Command Throw) [Command] name = "HCB_x" command = ~F, DF, D, DB, B, x time = 25 ; Double QCF (Super) [Command] name = "QCF_QCF_x" command = ~D, DF, F, D, DF, F, x time = 30 ; Charge Back-Forward [Command] name = "charge_BF_x" command = ~30B, F, x time = 20 ; Simple buttons [Command] name = "x" command = x [Command] name = "y" command = y [Command] name = "z" command = z [Command] name = "a" command = a [Command] name = "b" command = b [Command] name = "c" command = c [Command] name = "start" command = s ; Direction + button (command normals) [Command] name = "fwd_y" command = /F, y ; Dash [Command] name = "FF" command = F, F time = 10 [Command] name = "BB" command = B, B time = 10
AI Command Detection
For AI opponents, you can define AI activation commands:
[Command] name = "AI_1" command = D, D, D, D, D, D, D, D, D ; Impossible for human time = 1 ; 1 tick (impossible timing) [Command] name = "AI_2" command = U, U, U, U, U, U, U, U, U time = 1
Then in Statedef -1:
[State -1, AI Activate] type = VarSet trigger1 = command = "AI_1" trigger2 = command = "AI_2" var(59) = 1 ; AI flag
Tips
- •Always provide alternate input shortcuts for complex motions
- •Keep command.time generous (15-20) for special moves
- •Order Statedef -1 entries from complex to simple
- •Use
triggerall = statetypeto prevent wrong-state attacks - •Use
movecontactfor cancel windows,movehitfor hit-confirms - •Test inputs on both P1 (right-facing) and P2 (left-facing) sides
- •Include AI commands for computer opponents
- •Duplicate commands with different buttons (QCF_x, QCF_y, QCF_z)