Skip to content

Reference Script Functions Controllers

Kristopher Barrantes edited this page Nov 5, 2026 · 2 revisions

Game controllers script functions

Also on the Cuebot Docs site.

Functions for C# (Cb.Call) and Python (a cb method each, or cb.call). See Script functions for how to use them.

A Run Python code step in the action editor

controllers.get

Finds one game controller and tells you about it. Starts watching controllers if needed.

Value In Python What to put in
controller controller Optional. Which controller: a slot like "#1", part of its name, its type (like "PS5") or its GUID. Default "#1".

Gives back: The controller's details (name, slot, type, battery, held buttons, axes, hats), or null when none matches.

C#

var answer = await Cb.Call("controllers.get", new { controller = "#1" });

Python

answer = cb.controllers_get(controller="#1")

controllers.learn

Waits for you to press a button, move a stick or push the d-pad, then tells you what it was. Handy for finding a button's name.

Value In Python What to put in
timeoutMs timeout_ms Optional. How long to wait, in milliseconds (100 to 300000). Default 10000 (10 seconds).
controller controller Optional. Only listen to this controller (slot like "#1", name, type or GUID). Leave it out to listen to all.

Gives back: What was pressed: kind, name, label, controller (its details), triggerType, settings and description. null when nothing was pressed in time.

C#

var answer = await Cb.Call("controllers.learn", new { timeoutMs = 15000 });

Python

answer = cb.controllers_learn(timeout_ms=15000)

controllers.list

Lists the game controllers that are plugged in right now. Starts watching controllers if it was not already. Fails with an error when controller input is turned off.

Gives back: A list of controllers. Each has its name, slot number, type, battery, held buttons, axes (stick and trigger values) and hats (d-pad directions).

C#

var answer = await Cb.Call("controllers.list");

Python

answer = cb.controllers_list()

controllers.reloadMappings

Reads the controller mappings file (gamecontrollerdb.txt) again, so new controller types are known. Fails with an error when there is no such file.

Gives back: How many mappings were added. 0 when controller input is not running yet (the file is read when it starts).

C#

var answer = await Cb.Call("controllers.reloadMappings");

Python

answer = cb.controllers_reload_mappings()

controllers.rumble

Makes a game controller shake (rumble). Fails with an error when controller input is turned off.

Value In Python What to put in
controller controller Optional. Which controller: a slot like "#1", part of its name, its type or GUID. Several can be split with commas. Default "Any" (all of them).
low low Optional. Strength of the big, slow motor, 0-100 percent. Default 50.
high high Optional. Strength of the small, fast motor, 0-100 percent. Default 50.
durationMs duration_ms Optional. How long to shake, in milliseconds (1000 = 1 second, at most 60000). Default 500.

Gives back: How many controllers shook.

C#

var answer = await Cb.Call("controllers.rumble", new { controller = "#1", low = 80, high = 80, durationMs = 1000 });

Python

answer = cb.controllers_rumble(controller="#1", low=80, high=80, duration_ms=1000)

controllers.setLed

Changes the light colour on game controllers that have one, like a PlayStation controller. Fails with an error when the colour cannot be read.

Value In Python What to put in
controller controller Optional. Which controller: a slot like "#1", part of its name, its type or GUID. Default "Any" (all of them).
color color The colour as "#RRGGBB" (like "#FF0000" for red) or "r,g,b" (like "255,0,0").

Gives back: How many controllers changed colour.

C#

var answer = await Cb.Call("controllers.setLed", new { color = "#9146FF" });

Python

answer = cb.controllers_set_led(color="#9146FF")

controllers.status

Tells you whether game controller input is running and how.

Gives back: running (true/false), backend (the controller library in use), version, state, message (a status line) and mode (the watch setting from the Controllers page).

C#

var answer = await Cb.Call("controllers.status");

Python

answer = cb.controllers_status()

Clone this wiki locally