Skip to main content

SetStickValue

This function was added in DSL 5

Description

Set a stick's value.

This function is intended to be called during a ControllersUpdated event. Calling it at any other time may produce unexpected results.

function SetStickValue(stick, controller, value) --[[ ... ]] end

Parameters

  • stick: integer - The stick ID to set the value for.
  • controller: 0|1|2|3 - The controller to set the stick on.
  • value: number - The value to set the stick to.

Return Values

None.

Example

If player one is using keyboard, re-map their camera controls to use direct mouse input.

RegisterLocalEventHandler('ControllersUpdated', function()
if not IsUsingJoystick(0) then
local x, y = GetMouseInput()
SetStickValue(18, 0, -x * 0.02)
SetStickValue(19, 0, -y * 0.02)
end
end)