HOOZiDocs
Skip to content

input

Input + keybind formatter.


input.is_active(path) → bool

Parameters: path : string — control full path (hotkey control)

Returns whether this hotkey is currently active (depending on mode: Toggle = toggled on / Hold = currently held / Always = always true).


input.format(path, fn)

Attaches dynamic text + color hints to a keybind control. The formatter is only invoked while the hotkey is active (i.e. shown in the "active keybinds" overlay).

Parameters:

  • path : stringmenu element full path or Pattern B hotkey ID (both accepted)
  • fn : function(id : string) → string | { text = string, color = {r,g,b,a} }

Automatic path resolution

Pass the menu element full path (the natural form) — if that element is a KeybindControl that internally remaps its keybind to a stable ID, resolution follows through to that stable ID.

Call formResolution
input.format("settings.display.menu", fn)→ resolves to hotkey.menu_open
input.format("hotkey.menu_open", fn)→ used directly
input.format("KbHints.g.alarm", fn)→ user-defined KeybindControl with no remap, uses full path

fn return type

ReturnBehavior
stringDisplay the text in the theme color
table {text, color={r,g,b,a}}Custom text + color
otherLOG_ERR + falls back to default display

Owner-scoped: automatically unregistered when the script unloads.


input.unformat(path)

Path resolution behaves identically to input.format.


input.clipboard_get() → string

Reads the system clipboard. Returns an empty string when empty.

input.clipboard_set(text)

Writes the system clipboard.

lua
local key = input.clipboard_get()
if key ~= "" then gui.notify:info("read: " .. key) end

input.clipboard_set("hello")

Not provided: input.is_down(vk) — on a dual-machine setup, the OS key API reads the machine running the program, not the game player. To query player input, use game.localplayer.* fields (e.g. is_zooming, is_grenade). See Getting Started.


Example

lua
-- formatter #1: plain string
input.format("KbHints.g.alarm", function(id)
    return alarm_armed and "ARMED" or "OFF"
end)

-- formatter #2: return {text, color} table
input.format("KbHints.g.stopwatch", function(id)
    local sec = os.clock() - start_t
    return {
        text  = string.format("%.1fs", sec),
        color = { 0.55, 0.85, 1.0, 1.0 },
    }
end)

-- formatter #3: dynamic color by threshold
input.format("KbHints.g.counter", function(id)
    local label = string.format("× %d", counter)
    if counter == 0     then return { text = label, color = { 0.6, 0.6, 0.6, 1.0 } } end
    if counter < 10     then return { text = label, color = { 0.3, 1.0, 0.3, 1.0 } } end
    return { text = label, color = { 1.0, 0.45, 0.25, 1.0 } }
end)