What it does
Tells whether an input action is held down right now.
Syntax
ActionState(action string) → integerParameters
| Name | Type | Meaning |
|---|---|---|
| action | string | The action's name, as defined in the editor. |
Every form returns
integer
1 while the action is down, 0 otherwise or when the action does not exist.
Good to know
- An action counts as down when its value is above 0.5: see ActionValue().
Example · generated
DO Print(ActionState("value")) Sync()LOOPActionState is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.