Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Persistent
- #include xinput.ahk
- SetKeyDelay 100
- LT_Key = Null
- RT_Key = Null
- LastRT := LastLT :=
- XInput_Init()
- Loop {
- Loop, 4 {
- if State := XInput_GetState(A_Index-1) {
- LT := State.bLeftTrigger
- RT := State.bRightTrigger
- if (LT != LastLT) {
- Send % "{" . LT_Key . (LT ? " Down}" : " Up}")
- LastLT := LT
- }
- if (RT != LastRT) {
- Send % "{" . RT_Key . (RT ? " Down}" : " Up}")
- LastRT := RT
- }
- }
- }
- Sleep, 100
- }
- Joy1:: ; Button "A"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 1VAR = b
- if (LT < 1 and RT < 1) ; No triggers are held
- 1VAR = Enter
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 1VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 1VAR = null
- Send {%1VAR% down}
- SetTimer, WaitForButtonUpA, 30
- return
- WaitForButtonUpA:
- if not GetKeyState("Joy1")
- {
- Send {%1VAR% up}
- SetTimer, WaitForButtonUpA, off
- return
- }
- Send {%1VAR% down}
- return
- Joy2:: ; Button "B"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 2VAR = f
- if (LT < 1 and RT < 1) ; No triggers are held
- 2VAR = Esc
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 2VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 2VAR = null
- Send {%2VAR% down}
- SetTimer, WaitForButtonUpB, 30
- return
- WaitForButtonUpB:
- if not GetKeyState("Joy2")
- {
- Send {%2VAR% up}
- SetTimer, WaitForButtonUpB, off
- return
- }
- Send {%2VAR% down}
- return
- Joy3:: ; Button "X"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- {
- Send {LShift down}{d down}{LShift up}
- SetTimer, WaitForButtonUpXd, 30
- return
- WaitForButtonUpXd:
- if not GetKeyState("Joy3")
- {
- Send {d up}
- SetTimer, WaitForButtonUpXd, off
- return
- }
- Send {LShift down}{d down}{LShift up}
- return
- }
- if (LT < 1 and RT < 1) ; No triggers are held
- 3VAR = Space
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 3VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 3VAR = null
- Send {%3VAR% down}
- SetTimer, WaitForButtonUpX, 30
- return
- WaitForButtonUpX:
- if not GetKeyState("Joy3")
- {
- Send {%3VAR% up}
- SetTimer, WaitForButtonUpX, off
- return
- }
- Send {%3VAR% down}
- return
- Joy4:: ; Button "Y"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 4VAR = v
- if (LT < 1 and RT < 1) ; No triggers are held
- 4VAR = NumpadMult
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 4VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 4VAR = l
- Send {%4VAR% down}
- SetTimer, WaitForButtonUpY, 30
- return
- WaitForButtonUpY:
- if not GetKeyState("Joy4")
- {
- Send {%4VAR% up}
- SetTimer, WaitForButtonUpY, off
- return
- }
- Send {%4VAR% down}
- return
- Joy5:: ; Button "LB"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- {
- Send {LShift down}{w down}{LShift up}
- SetTimer, WaitForButtonUpYw, 30
- return
- WaitForButtonUpYw:
- if not GetKeyState("Joy5")
- {
- Send {w up}
- SetTimer, WaitForButtonUpYw, off
- return
- }
- Send {LShift down}{w down}{LShift up}
- return
- }
- if (LT < 1 and RT < 1) ; No triggers are held
- 5VAR = NumpadHome
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 5VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 5VAR = null
- Send {%5VAR% down}
- SetTimer, WaitForButtonUpLB, 30
- return
- WaitForButtonUpLB:
- if not GetKeyState("Joy5")
- {
- Send {%5VAR% up}
- SetTimer, WaitForButtonUpLB, off
- return
- }
- Send {%5VAR% down}
- return
- Joy6:: ; Button "RB"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 6VAR = a
- if (LT < 1 and RT < 1) ; No triggers are held
- 6VAR = NumpadPgUp
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 6VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 6VAR = null
- Send {%6VAR% down}
- SetTimer, WaitForButtonUpRB, 30
- return
- WaitForButtonUpRB:
- if not GetKeyState("Joy6")
- {
- Send {%6VAR% up}
- SetTimer, WaitForButtonUpRB, off
- return
- }
- Send {%6VAR% down}
- return
- Joy7:: ; Button "BACK"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 7VAR = null
- if (LT < 1 and RT < 1) ; No triggers are held
- 7VAR = /
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 7VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 7VAR = null
- Send {%7VAR% down}
- SetTimer, WaitForButtonUpBACK, 30
- return
- WaitForButtonUpBACK:
- if not GetKeyState("Joy7")
- {
- Send {%7VAR% up}
- SetTimer, WaitForButtonUpBACK, off
- return
- }
- Send {%7VAR% down}
- return
- Joy8:: ; Button "START"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 8VAR = ?
- if (LT < 1 and RT < 1) ; No triggers are held
- 8VAR = j
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 8VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 8VAR = null
- Send {%8VAR% down}
- SetTimer, WaitForButtonUpSTART, 30
- return
- WaitForButtonUpSTART:
- if not GetKeyState("Joy8")
- {
- Send {%8VAR% up}
- SetTimer, WaitForButtonUpSTART, off
- return
- }
- Send {%8VAR% down}
- return
- Joy9:: ; Button "Left Joystick push"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 9VAR = null
- if (LT < 1 and RT < 1) ; No triggers are held
- 9VAR = NumpadClear
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 9VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 9VAR = null
- Send {%9VAR% down}
- SetTimer, WaitForButtonUpLJP, 30
- return
- WaitForButtonUpLJP:
- if not GetKeyState("Joy9")
- {
- Send {%9VAR% up}
- SetTimer, WaitForButtonUpLJP, off
- return
- }
- Send {%9VAR% down}
- return
- Joy10:: ; Button "Right Joystick push"
- if (LT >= 1 and RT >= 1) ; Both triggers are held
- 10VAR = null
- if (LT < 1 and RT < 1) ; No triggers are held
- 10VAR = NumpadIns
- if (LT >= 1 and RT < 1) ; Left trigger is held
- 10VAR = null
- if (LT < 1 and RT > 1) ; Right trigger is held
- 10VAR = null
- Send {%10VAR% down}
- SetTimer, WaitForButtonUpRJP, 30
- return
- WaitForButtonUpRJP:
- if not GetKeyState("Joy10")
- {
- Send {%10VAR% up}
- SetTimer, WaitForButtonUpRJP, off
- return
- }
- Send {%10VAR% down}
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement