Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

PGarglerundefined

PGargler

@PGargler
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
4
Following
4

Posts

Recent Best Controversial

  • Scripts for automatic pause upon controller disconnect
    PGarglerundefined PGargler

    fixed ControllerMonitor.ahk:

    #Requires AutoHotkey v2.0
    #SingleInstance Force
    
    ; Include the XInput library
    #include XInput.ahk
    
    global isConnected := false
    
    SetTimer(CheckController, 16)  ; 60 times per second (16ms interval)
    
    ; Define the hotkey to exit the script
    #!x::ExitApp  ; Terminates the script
    
    CheckController() {
        global isConnected  ; Explicitly declare the global variable
    
        state := Buffer(16, 0)  ; Ensure the buffer is correctly allocated
        if (XInput_GetState(0, state) == 0) {  ; 0 means connected
            if (!isConnected) {
                isConnected := true
            }
        } else {
            if (isConnected) {
                isConnected := false
                Send("p")  ; Send 'p' on disconnection
            }
        }
    }
    
    General Discussion
  • 1 / 1
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate