1.63 Pad .512 1.63.1 Pad.CreatePads .512 1.63.2 Pad.GetAnalogExtent .512 1.63.3 Pad.GetPad .513 1.63.4 Pad.GetSensorForwards .513 1.63.5 Pad.GetSensorRight .514 1.63.6 Pad.GetSensorllp .515 1.63.7 Pad.IsCircleAccept .515 1.63.8 Pad.IsConnected .516 1.63.9 Pad.IsHeld .516 1.63.10 Pad.Reserve .517 1.63.11 Pad.SetActuator .518 1.63.12 Pad.UnReserve .519 1.63.13 Pad.UnReserveAll .520 1.63.14 Pad.WasAnyJustPressed .520 1.63.15 Pad.WasJustPressed .521 1.63.16 Pad.WasJustReleased .522 Pad Pad.CreatePads Brief Creates the specified number of pads. Definition ! Pad.CreatePads( number padCount = 1 ) Arguments padCount - The number of pads required. Valid range is 1 to 4. Return Values None. Description Creates the specified number of pads required by the script. This should never be called more than once. Examples ! — Create a single pad i Pad.CreatePads() j pad = Pad.GetPadO See Also • Pad.GetPad Pad.GetAnalogExtent Brief Returns the analog value of the stick, button or sensor. Definition ! number Pad.GetAnalogExtent( Pad pad, number actionld ) Arguments pad - The pad to query.actionld - The user defined action ID corresponding to a button ID. Return Values The analogue value of the controller stick, button or sensor. Description Returns the analog value of the stick, button or motion sensor in the following ranges: Analogue stick: -1.0 to 1.0. Analogue button: 0.0 (not pressed) to 1.0 (fully pressed). Motion sensor: -1.0 to 1.0. Note: For the motion sensor, if the controller is stationary, gravity will still cause the returned value to be non-zero (depending on the angle at which the controller is held). Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO TURN_LEFT = 5 Pad.Reserve( pad, PAD_DPAD_LEFT, TURN_LEFT ) function OnUpdateO print( "Button value = " .. Pad.GetAnalogExtent( pad, myLeft ) ) end See Also • Pad.CreatePads • Pad.GetPad • Pad.Reserve Pad.GetPad Brief Gets the specified pad object. Definition Pad Pad.GetPad( number which = 1 ) Arguments which - The pad to get. Ranges from 1 to the number of pads created. Return Values The pad corresponding to the specified index or nil on failure. Description Gets the specified pad object. Examples — Create two pads Pad.CreatePads( 2 ) padl = Pad.GetPad( 1 ) pad2 = Pad.GetPad( 2 ) See Also • Pad.CreatePads Pad.GetSensorForwards Brief Returns the vector for the forwards direction of the pad. Definition ! Vector4 Pad.GetSensorForwards( Pad pad ) Arguments pad - The pad to query. Return Values The vector for the forwards direction of the pad. Description Returns the vector for the forwards direction of the pad. Examples ! local direction = Pad.GetSensorForwards( pad ) See Also • Pad.GetSensorRight • Pad.GetSensorllp Pad.GetSensorRight Brief Returns the vector for the right direction of the pad. Definition ! Vector4 Pad.GetSensorRight( Pad pad ) Arguments pad - The pad to query. Return Values The vector for the right direction of the pad. Description Returns the vector for the right direction of the pad. Examples local direction = Pad.GetSensorRight( pad ) See Also • Pad.GetSensorllp • Pad.GetSensorForwards Pad.GetSensorllp Brief Returns the vector for the up direction of the pad. Definition j Vector4 Pad.GetSensorUp( Pad pad ) Arguments pad - The pad to query. Return Values The vector for the up direction of the pad. Description Returns the vector for the up direction of the pad. Examples j local direction = Pad.GetSensorUp( pad ) See Also • Pad.GetSensorRight • Pad.GetSensorForwards Pad.lsCircleAccept Brief Returns true if the pad associates PAD_CIRCLE with PAD_ACCEPT and false otherwise. Definition I boolean Pad.IsCircleAccept( Pad pad ) Arguments pad - The pad to query. Return Values Returns true if the pad associates PAD_CIRCLE with PAD_ACCEPT and false otherwise. Description Returns true if the pad associates PAD_CIRCLE with PAD_ACCEPT and false otherwise. Examples Pad.CreatePads() pad = Pad.GetPadO if( Pad.IsCircleAccept( pad ) ) then print( "Pad uses circle for accept" ); else print( "Pad uses cross for accept" ); end See Also • Pad.CreatePads • Pad.GetPad Pad.lsConnected Brief Returns true if the pad is connected and false otherwise. Definition I boolean Pad.IsConnected( Pad pad ) Arguments pad - The pad to query. Return Values true if the pad is connected and false otherwise. Description Returns true if the pad is connected and false otherwise. Examples | Pad.CreatePads() i pad = Pad.GetPadO | print( "Pad connected = " .. Pad.IsConnected( pad ) ) See Also • Pad.CreatePads • Pad.GetPad Pad.lsHeld Brief Detects whether the specified reserved pad button is currently pressed. Definition boolean Pad.IsHeld( Pad pad, number actionld ) Arguments pad - The pad to query.actionld - The user defined action ID corresponding to a button ID Return Values true if the button is held and false otherwise. Description Detects whether the reserved pad button associated with the specified action ID is currently pressed. Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO FIRE_LASER = 5 Pad.Reserve( pad, PAD_CROSS, FIRE_LASER ) function OnUpdateO if Pad.IsHeld( pad, FIRE_LASER ) then print ( "Laser firing sustained blast!" ) end end See Also • Pad.CreatePads • Pad.GetPad • Pad.Reserve Pad. Reserve Brief Makes a controller function queryable. Definition Pad.Reserve( Pad pad, number buttonld, number actionld = buttonld, boolean repeat = false, boolean dropThrough = false ) Arguments pad - The pad to affect.buttonld - The controller function to reserve. Can be one of the following: PAD_DPAD_UP PAD_DPAD_DOWN PAD_DPAD_LEFT PAD_DPAD_RIGHT PAD_JOY_LEFT_X PAD_JOY_LEFT_Y PAD_JOY_RIGHT_X PAD_JOY_RIGHT_Y PAD_ACCEPT PAD_SQUARE PAD_TRIANGLE PAD_DECLINE PAD_L1_SH0ULDER PAD_L2_SH0ULDER PAD_L3_J0Y PAD_R1_SH0ULDER PAD_R2_SH0ULDER PAD_R3_J0Y PAD_CROSS PAD_CIRCLE PAD_SENSOR_AXIS_X PAD_SENSOR_AXIS_Y PAD_SENSOR_AXIS_Z PAD_SENSOR_GYRO_Y PAD_ACTUATOR_SMALL PAD_ACTUATOR_BIGactionld - The user defined action ID to map the button ID to.repeat - If set to true, the Pad.WasJustPressed function can return true for a single button press which is held down continuously.dropThrough - If set to true, other input handlers with lower priority can also receive the button event. Normally only the highest priority input handler with the button reserved will receive the button event. Return Values None. Description Reserves the specified controller function and assigns an abstract action ID to use for that button. Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO FIRE_LASER = 5 Pad.Reserve( pad, PAD_CROSS, FIRE_LASER ) See Also • Pad.UnReserve Pad.SetActuator Brief Sets the specified actuator's vibration strength. Definition boolean Pad.SetActuator( Pad pad, number actuator, number value ) Arguments pad - The pad to affect.actuator - The actuator to set. Can be one of the following: PAD_ACTUATOR_SMALL PAD_ACTUATOR_BIGvalue - The value to set the actuator to. Valid values for PAD_ACTUATOR_SMALL are only 0 or 1, for PAD_ACTUATOR_BIG it is all values from 0.0 to 1.0. Return Values true if sucessfully set and false otherwise. Description Sets the specified actuator's vibration strength. If called by multiple scripts or the same script multiple times per frame it accumulates the values. The actuator must be reserved before it can be set. The small actuator can only be on or off, the rotation frequency cannot be changed. Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO Pad.Reserve( pad, PAD_ACTUATOR_BIG ) Pad.Reserve( pad, PAD_ACTUATOR_SMALL ) function OnUpdateO if ( smallEarthquake == true ) then Pad.SetActuator( pad, PAD_ACTUATOR_SMALL, 0.5) elseif ( bigEarthquake == true ) then Pad.SetActuator( pad, PAD_ACTUATOR_BIG, 1.0) end end See Also • Pad.CreatePads • Pad.GetPad • Pad.Reserve Pad.UnReserve Brief Relinquishes the previously reserved action ID. Definition j Pad.UnReserve( Pad pad, number actionld ) Arguments pad - The pad to affect.actionld - The action ID to unreserve. Return Values None. Description Relinquishes the previously reserved action ID. Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO FIRE_LASER = 5 Pad.Reserve( pad, PAD_CROSS, FIRE_LASER ) — Termination code Pad.UnReserve( pad, FIRE_LASER ) See Also • Pad.CreatePads • Pad.GetPad • Pad.Reserve Pad.UnReserveAll Brief Relinquishes any previously reserved action IDs. Definition | Pad.UnReserveAll(Pad pad) Arguments pad - The pad to affect. Return Values None. Description Relinquishes any previously reserved action IDs. Examples i Pad.UnReserveAll(pad) See Also • Pad.Reserve • Pad.UnReserve Pad.WasAnyJustPressed Brief Detects whether any reserved pad button was pressed. Definition ! boolean Pad.WasAnyJustPressed( Pad pad ) Arguments pad - The pad to query. Return Values true if any reserved button was just pressed and false otherwise. Description Detects whether any reserved pad button was pressed. Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO FIRE_LASER = 5 FIRE_MINIGUN = 6 Pad.Reserve( pad, PAD_SQUARE, FIRE_LASER ) Pad.Reserve( pad, PAD_CIRCLE, FIRE_MINIGUN ) function OnUpdateO if Pad.WasAnyJustPressed( pad ) then print( "A weapon was fired!" ) end end See Also • Pad.CreatePads • Pad.GetPad • Pad.Reserve Pad.WasJustPressed Brief Detects whether the specified reserved pad button was pressed. Definition boolean Pad.WasJustPressed( Pad pad, number actionld ) Arguments pad - The pad to query.actionld - The user defined action ID corresponding to a button ID. Return Values true if the button was pressed and false otherwise. Description Detects whether the reserved pad button associated with the specified action ID was pressed. Note that analogue sticks moving outside their dead zone counts as a button press. Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO FIRE_LASER = 5 Pad.Reserve( pad, PAD_CROSS, FIRE_LASER ) function OnUpdateO if Pad.WasJustPressed( pad, FIRE_LASER ) then print( "Laser fired successfully!" ) end end See Also • Pad.CreatePads • Pad.GetPad • Pad.Reserve Pad.WasJustReleased Brief Detects whether the specified reserved pad button was released. Definition ! boolean Pad.WasJustReleased( Pad pad, number actionld ) Arguments pad - The pad to query.actionld - The user defined action ID corresponding to a button ID Return Values true if the button was just released and false otherwise. Description Detects whether the reserved pad button associated with the specified action ID was released. Note that analogue sticks returning to their dead zone counts as a button release. Examples — Initialization code Pad.CreatePads() pad = Pad.GetPadO FIRE_LASER = 5 Pad.Reserve( pad, PAD_CROSS, FIRE_LASER ) function OnUpdateO if Pad.WasJustReleased( pad, FIRE_LASER ' print( "Laser deactivated!" ) end end then See Also • Pad.CreatePads • Pad.GetPad • Pad.Reserve