API
Lua runtime helpers available in VParamix Generic Script programs.
Program setup
Every Generic Script file declares its outputs once during setup and defines one update() function.
local params = vparamix.params
local face = vparamix.face
local output = params.declare({
{ name = "Value", min = 0, max = 1, default = 0 },
})
function update()
output.set("Value", face.get("EyeBlinkLeft"))
endoutput.set() must set every declared output. An update that fails, omits an output, or produces a non-finite value commits none of its outputs or state.
Input namespaces
| Helper | Detail |
|---|---|
vparamix.params.get(name) | Current non-face source, VTube Studio status, or prior committed Script output. |
vparamix.params.get_previous(name) | The matching input from this program's previous successful commit. |
vparamix.face.get(name) | Current raw face tracking value, including blendshapes, face status, head, position, and eye rotation. |
vparamix.face.get_previous(name) | The matching face input from the previous successful commit. |
Known but unavailable inputs return their default. Unknown names and wrong namespaces are errors.
Timing and values
| Helper | Detail |
|---|---|
dt() | Seconds since this program's previous successful commit. Starts at 0. |
time() | Seconds since this program's runtime clock started. |
vts_ups() | Configured VTube Studio update rate, not measured network throughput. |
finite(value) | Returns false for NaN or positive/negative infinity. |
number(value) | Converts numbers, booleans, and numeric strings; unsupported values become 0. |
Saved state
| Helper | Detail |
|---|---|
save(id, value) | Stages numeric program-private state and returns the value. |
load(id, default) | Reads staged or committed state, or returns default. |
State is committed only after the complete update succeeds. A program can retain up to 256 state IDs.
Randomness
| Helper | Detail |
|---|---|
rand() | Uniform random number in [0, 1). |
rand_float() | Uniform random number in [0, 1). |
rand_float(max) | Random value between 0 and max. |
rand_float(min, max) | Random value between the supplied bounds. |
rand_bool(probability) | Boolean sample; probability defaults to 0.5 and clamps to 0..=1. |
Keyboard
| Helper | Detail |
|---|---|
keyboard.down(key) | Every mapped current key parameter is down. |
keyboard.pressed(key) | The key changed from up to down. |
keyboard.released(key) | The key changed from down to up. |
keyboard.combo(keys) | Every mapped key in the combo is down. |
keyboard.combo_pressed(keys) | The combo has just become down. |
keyboard.shortcut_pressed(action, modifiers) | The action transitioned down while all modifiers are down. |
VTube Studio input values
Read these through vparamix.params.get():
VtsConnectedVtsModelLoadedVtsFaceFoundVtsHotkeyEventVtsAnimationEvent
VTube Studio actions are documented on the VTS API page.
Comments beginning with -- @inspect can expose local literals as editor controls.