wrong Script

Post gaming related scripts
Serquik
Posts: 2
Joined: 14 Apr 2023, 06:18

wrong Script

14 Apr 2023, 06:23

Code: Select all

key1 := "d"
key2 := "s"
key3 := "a"
key4 := "w"
interval := 30000

state := 1
toggleKey := "CapsLock"
SetTimer, ToggleKeys, %interval%
return

ToggleKeys:
    if GetKeyState(toggleKey) {
        if (state = 1) {
            SendInput, {%key1% Down}{%key2% Down}{LButton Down}
            Sleep, %interval%
            SendInput, {%key1% Up}{%key2% Up}{LButton Up}
            state := 2
        } else {
            SendInput, {%key3% Down}{%key4% Down}{LButton Down}
            Sleep, %interval%
            SendInput, {%key3% Up}{%key4% Up}{LButton Up}
            state := 1
        }
    }
    return
What's wrong with this code? It's supposed to hold down the W A S D keys at a certain interval with the left mouse button held down, but when I press Caps Lock, nothing happens.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: wrong Script

14 Apr 2023, 10:03

For the toggle see help file for: GetKeyState --> read about the Mode parameter.

Your script shows nothing about using the left mouse button (LButton)

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 14 guests