Getting Started
Create and run your first VParamix Lua script.
This tutorial creates a Script parameter named TutorialPulse. Its value moves continuously between 0 and 1 without requiring another input source.
Create a script
- Open Sources → Script.
- Select + New Script.
- Replace the generated code with this program:
local params = vparamix.params
local output = params.declare({
{ name = "TutorialPulse", min = 0, max = 1, default = 0 },
})
function update()
local pulse = (math.sin(time() * math.pi * 2) + 1) / 2
output.set("TutorialPulse", pulse)
endThe setup code declares one output parameter. VParamix then calls update() every Script frame and publishes the value passed to output.set().
Save and enable the script
- Save the pending script change.
- Select the checkbox beside the script name in the left panel.
- Confirm that
TutorialPulseappears in the Script output panel and moves between0and1.
If the editor shows an error, select the script and read its diagnostic. Every declared output must receive a finite number during each successful update.
Read a live parameter
Use vparamix.params.get() to read a regular source parameter. For example, replace update() with the following code to drive the output from microphone volume:
function update()
local volume = params.get("MicVolume")
output.set("TutorialPulse", volume)
endUse vparamix.face.get() instead when reading raw face-tracking parameters. Parameter names are listed on the relevant source pages.
Add an Inspector control
Place an @inspect annotation immediately before a supported local literal to edit it from the Inspector:
-- @inspect min=0 max=2 step=0.01
local gain = 1.00
function update()
local volume = params.get("MicVolume")
output.set("TutorialPulse", volume * gain)
endThe Inspector writes the selected value back into the Lua literal. See the Inspector reference for every control and selector.
Next steps
- Use the Lua API for declarations, input values, timing, saved state, random values, math, and keyboard input.
- Use the Inspector reference for editable script controls.
- Use the VTube Studio API to read VTS state and request VTS actions.
Last updated on