Here, lemme show some code on one of my chars.
At the top of Statedef 200, Stand Light Punch, I have this as the initial definition:
type = S
physics = S
ctrl = 0
anim = 200
sprpriority = 2
poweradd = 20
hitcountpersist = 1
'ctrl = 0' is necessary (for me at least lol) cause it takes away control from the player, meaning as long as the attack is going on, the player cannot override it with any other inputs.
In the cmd file, I have this for the trigger:
type = ChangeState
value = 200
triggerall = roundstate = 2 && !AILevel;(59)
triggerall = command = "x" && command != "holddown"
trigger1 = statetype = S && ctrl
The main important thing here is the trigger1. The move only occurs when the player is standing, and has control. Which they only have if it's set to 1, not to 0, obviously.
Does that make sense?