Skip to content

DrSpeedy/speedys-pad-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Speedy's Pad Handler

Overview

Library for devs who want advnaced user input features without the headache. Quickly create functions for keyboard or controller using a markup language. Supports tap counting, holds, just down/up and cheat code style sequencing

Questions

Just DM me or ping me in #share-discussions

Examples:

CheckInput('[D]VK(48):[T2]RB')

True when VK48 - Zero is held down and RB is tapped twice on the controller

CheckInput('[D]VK(48):[F]SEQ(RB,LB,X)')

True when VK48 - Zero is held down and RB, LB, X are pressed in sequence on the controller

Example Script Included:

  • Super jump - Double tap X on controller or Space on keyboard
  • TP To Chiliad - LB + RB + X + A in sequence

Extended Documentation:

Functions:

 * <void> StartPadHandler()
 * <void> StopPadHandler()
 * <bool> CheckInput(cmd_str)
 * <void> DisableControlThisTick(ctrl_key)
 * <void> DisableAllControlsThisTick(whitelist_tbl)

Variables:

iTickDelay = Number of ticks allowed between button taps/switching from single press to hold
iPadIdx = Pad index to use when calling IS_CONTROL_PRESSED native
SeqBufferSize = Max size of the sequence buffer
bSeqIgnoreAnalogSticks = Add/don't add analog sticks to the seq buffer

Opcodes:

T: Tap
H: Held Down (Delayed)
D: Down
U: Up
R: Just Released
F: Function

T, H Both can take a numeric argument with the following
syntax: [T2], [H4]; If no arugment is supplied, the arg will
default to 1. This argument is the number of taps needed to meet
the input condition

More Examples:

function SomeFunc()
    -- Disable all input to game except for LEFT_STICK and RIGHT_STICK
    DisableAllControlsThisTick({'LEFT_STICK', 'RIGHT_STICK'})

    -- If LB is pressed twice and held on the 2nd press
    if (CheckInput('[H2]LB')) then
        do_something()
    end

    -- If LB is pressed twice and released on 2nd press
    if (CheckInput('[T2]LB')) then
        do_something()
    end

    -- If LT is just held down and then X is tapped once and released
    if (CheckInput('[D]LT:[T]X')) then
        do_something()
    end

    -- If VK(48) and LB are down and RB is tapped 3 times
    if (CheckInput('[D]VK(48):[D]LB:[T3]RB')) then
        do_something()
    end
end

About

Gamepad Handler for GTAV using Stand's LUA API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages