getAnalogControlState
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This retrieves the analog control state of a control. This is useful for detecting sensitive controls, such as those used on a joypad.
Syntax
float getAnalogControlState ( string control, bool rawValue )Required Arguments
- control: The control that you want to get the state of. See control names for a list of possible controls.
- rawValue: A bool indicating if it should return the raw player input value.
Returns
- float: value
Returns a float between 0 and 1 indicating the amount the control is pressed.
Code Examples
shared
This creates an/forwardscommand, which toggles yourforwardscontrol state between 0 and 1.
addCommandHandler( "forwards", function( ) if ( getAnalogControlState( "forwards" ) == 0 ) then setAnalogControlState( "forwards", 1 ) else setAnalogControlState( "forwards", 0 ) end end)See Also
Input Functions
- addCommandHandler
- bindKey
- executeCommandHandler
- getAnalogControlState
- getBoundKeys
- getCommandHandlers
- getCommandsBoundToKey
- getFunctionsBoundToKey
- getKeyBoundToCommand
- getKeyBoundToFunction
- getKeyState
- isCapsLockEnabled
- isControlEnabled
- isKeyBound
- removeCommandHandler
- setAnalogControlState
- toggleAllControls
- toggleControl
- unbindKey
Input Events
- onClientCharacter
- onClientClick
- onClientCursorMove
- onClientDoubleClick
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientKey
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
- onClientPaste