ActionState

Family: Studio · One form

What it does

Tells whether an input action is held down right now.

Syntax

ActionState(action string) → integer

Parameters

NameTypeMeaning
actionstringThe 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()LOOP

ActionState 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.

133 commands in Studio