ActionHint
constActionHint:object
Defined in: client/api.d.ts:3581
“Press [key] to …” hints, drawn by the game’s own HUD beside its own, with a handler run when the player presses the key.
A hint names one of the game’s keys by its control – primary_action, jump and the rest of keys() – and never a physical key: the glyph is whatever the player has bound to that control, keyboard or pad, and follows a rebind. A press hint fires on the press; a hold hint draws the game’s ring and fires once it fills.
Hints are drawn while the player is in control of their character, on foot or in the saddle, and the game takes them down in dialogue, minigames and menus. Two hints on one key stack: the newest is drawn and gets the press, and removing it brings back the one under it. A hint normally leaves the game’s own action on that key enabled. chat_focus_follow_init replaces the native focus/follow toggle while its hint is shown, so a scripted Follow action receives one press.
Client-only and local: a hint is shown to the player at this machine. Hints go when the resource that made them stops.
Type Declaration
Section titled “Type Declaration”create()
Section titled “create()”create(
options,handler):number
Puts a hint up. It is drawn from the next frame the player is in control.
Parameters
Section titled “Parameters”options
Section titled “options”key is one of keys(). text is what the HUD writes beside the key, as written, at most 256 bytes. mode is “press” by default. holdDuration is how long a hold hint’s ring takes to fill, 0.2 to 10 seconds, 1 by default. enabled false draws the hint greyed out and keeps the handler from running.
enabled?
Section titled “enabled?”boolean
holdDuration?
Section titled “holdDuration?”number
string
"press" | "hold"
string
handler
Section titled “handler”Run with the hint’s id each time it fires.
Returns
Section titled “Returns”number
The hint’s id. Throws when an option is out of range or the key is not one of keys().
keys()
Section titled “keys()”keys():
string[]
The controls a hint can be put on.
Returns
Section titled “Returns”string[]
Control names, in a fixed order.
remove()
Section titled “remove()”remove(
hint):boolean
Takes a hint down for good.
Parameters
Section titled “Parameters”number
An id from create.
Returns
Section titled “Returns”boolean
False when it was already gone.
setEnabled()
Section titled “setEnabled()”setEnabled(
hint,enabled):boolean
Greys a hint out, or brings it back.
Parameters
Section titled “Parameters”number
An id from create.
enabled
Section titled “enabled”boolean
False greys the hint out and its handler stops running.
Returns
Section titled “Returns”boolean
False when the hint is gone.
setText()
Section titled “setText()”setText(
hint,text):boolean
Rewrites a hint’s text in place.
Parameters
Section titled “Parameters”number
An id from create.
string
The new text, as written, at most 256 bytes.
Returns
Section titled “Returns”boolean
False when the hint is gone or the text is too long.