AgentSkillsCN

Command Input

在创建或编辑命令输入文件(.cmd)、定义移动输入(四分之一圆、龙拳、蓄力招式)、设置Statedef -1命令检测状态,或配置按键映射时使用此技能。涵盖命令记法、输入窗口、缓冲时机,以及动作优先级排序。

SKILL.md
--- frontmatter
description: Use this skill when creating or editing command input files (.cmd), defining move inputs (quarter circles, dragon punches, charge moves), setting up the Statedef -1 command detection state, or configuring button mappings. Covers command notation, input windows, buffer timing, and move priority ordering.

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:

  1. [Remap] -- Button remapping
  2. [Defaults] -- Default timing values
  3. [Command] blocks -- Input definitions
  4. [Statedef -1] -- Command detection logic

Input Notation

Directional Inputs

code
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

code
x = Light Punch      a = Light Kick
y = Medium Punch     b = Medium Kick
z = Heavy Punch      c = Heavy Kick
s = Start button

Input Modifiers

code
~  = 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

ini
[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:

  1. Super moves (most complex inputs, highest priority)
  2. Special moves (motion inputs)
  3. Command normals (direction + button)
  4. Normal attacks (single button)
  5. 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

ini
[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:

ini
; 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

ini
; 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:

ini
[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:

ini
[State -1, AI Activate]
type = VarSet
trigger1 = command = "AI_1"
trigger2 = command = "AI_2"
var(59) = 1    ; AI flag

Tips

  1. Always provide alternate input shortcuts for complex motions
  2. Keep command.time generous (15-20) for special moves
  3. Order Statedef -1 entries from complex to simple
  4. Use triggerall = statetype to prevent wrong-state attacks
  5. Use movecontact for cancel windows, movehit for hit-confirms
  6. Test inputs on both P1 (right-facing) and P2 (left-facing) sides
  7. Include AI commands for computer opponents
  8. Duplicate commands with different buttons (QCF_x, QCF_y, QCF_z)