Hey, I've recently been introduced to AHK and I've fell in love ever since.
I play a game that is really really old, Grand Theft Auto: San Andreas and I tried doing a script that would spam the spacebar whenever I hold the spacebar key and stop when I release but I didn't manage to do it.
If someone could please make a bind that can do this please do, I'll be very thankful!
((P.S the spacebar in GTA:SA makes your character sprint and when you tap the spacebar you get way more speed))
Spam script.
-
- Posts: 2
- Joined: 07 Mar 2019, 13:58
-
- Posts: 188
- Joined: 17 Jan 2019, 10:13
Re: Spam script.
Check the AHK reddit, it has lots of 'basic' scripts
https://www.reddit.com/r/AutoHotkey/comments/4f4j9k/read_this_before_posting/
You'll need to scroll about halfway through the page to chapter 2. This is the one you need, I left the comments in so you might be able to learn something from it
With WinActive you are able to activate the script only when GTA SA is running, I recommend checking it out.
https://autohotkey.com/docs/commands/WinActive.htm
https://www.reddit.com/r/AutoHotkey/comments/4f4j9k/read_this_before_posting/
You'll need to scroll about halfway through the page to chapter 2. This is the one you need, I left the comments in so you might be able to learn something from it
Code: Select all
; The hook $ hotkey modifier prevents a hotkey from firing itself.
; If 'a' is the hotkey, and it sends 'a', it would keep looping
$space::
; Run the label AutoFireA
GoSub, AutoFireA
return
; Label auto firing
AutoFireA:
; Send a key. We're using 'b'
Send, {space}
; Check to see if 'a' is still being held down
if GetKeyState("a", "P")
; If yes, set a timer to run this label again. Time is in ms
; Using a negative number fires the timer once instead of repeatedly.
SetTimer, AutoFireA, -100
return
https://autohotkey.com/docs/commands/WinActive.htm
-
- Posts: 2
- Joined: 07 Mar 2019, 13:58
Re: Spam script.
I was hoping if someone could write the script for me, I tried doing it myself but it doesn't seem to work.
Who is online
Users browsing this forum: slishnevsky and 36 guests