I've used the autohotkey program for utilizing a rapid fire script before on my mouse, but what I would like to know is how would you write it to work on a keyboard rather than a mouse? For example, Ctrl being the hot key and Xbutton being the rapid fire key.
Autohotkey and Rapid fire Keyboard
Started by
Fenrir
, Feb 20 2011 06:02 PM
35 replies to this topic
#1
-
Posted 20 February 2011 - 06:02 PM
*~$Ctrl:: Loop { SetMouseDelay 30 Send, {XButton1} If (GetKeyState("Ctrl","P")=0) Break } return
Pressing and holding Control (either one) will spam xbutton1.
Feel free to adjust the setmousedelay time as I had jsut adapted the code I have to spam the right click and left click for Red Alert3 instead of pressing 50 times to build 50 people as I have worn out a couple mouses due to Red Alert 3 and Red Alert2. haha
#2
-
Posted 20 February 2011 - 08:15 PM
*~$Ctrl:: Loop { SetMouseDelay 30 Send, {XButton1} If (GetKeyState("Ctrl","P")=0) Break } return
Pressing and holding Control (either one) will spam xbutton1.
Feel free to adjust the setmousedelay time as I had jsut adapted the code I have to spam the right click and left click for Red Alert3 instead of pressing 50 times to build 50 people as I have worn out a couple mouses due to Red Alert 3 and Red Alert2. haha
Awesome. I know it's simple code but you guys work miracles from my perspective. Though what I never understood was why would you have to write "mousedelay" when the mouse isn't even involved? lol
Thanks a ton codybear
#3
-
Posted 20 February 2011 - 08:53 PM
Eventhough you're using a keyboard key to spam the xbutton, the xbutton is a special mouse button, therefore the mouse delay comes into affect and not the setkeydelay. I read this somewhere in the docs earlier this week again. Not quite sure where in the docs it is located though.Though what I never understood was why would you have to write "mousedelay" when the mouse isn't even involved? lol
#4
-
Posted 20 February 2011 - 10:16 PM
Okay so I've been playing with the script but a problem comes up with using the Ctrl key. I guess what's happening is when I press the ctrl key and the X key the computer sees it as an entirely different event as opposed to just pressing the X key once or twice (xbutton1 and xbutton2 events).
What I need it to do for this to work is to be able to press down and hold ctrl then the X key at the same time and then Xbutton goes into rapid fire.
I've been playing around with another script as well:
I don't know if I just need to enter in another argument value in place of Xbutton1 for the computer to recognize ctrl and X key or if this issue requires a whole other script to work. I tried ctrl_X and ctrl-X but that didn't seem to work either.
What I need it to do for this to work is to be able to press down and hold ctrl then the X key at the same time and then Xbutton goes into rapid fire.
I've been playing around with another script as well:
Ins::Suspend Xbutton1:: Loop { Setmousedelay 30 Click If (GetKeyState("Xbutton1","P")=0) Break }
I don't know if I just need to enter in another argument value in place of Xbutton1 for the computer to recognize ctrl and X key or if this issue requires a whole other script to work. I tried ctrl_X and ctrl-X but that didn't seem to work either.
#5
-
Posted 20 February 2011 - 10:37 PM
What I need it to do for this to work is to be able to press down and hold ctrl then the X key at the same time and then Xbutton goes into rapid fire.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ^x:: Loop { GetKeyState, Autovar, x, P If Autovar = U Break Send {XButton1} sleep 0 ; You can change this value to get the desired rate of clicks. } ; The following lists the number of clicks within ten seconds per x milliseconds of sleep: ;140 = 59 clicks ;130 = 65 clicks <- average highest human speed ;120 = 65 clicks ;110 = 72 clicks ;90 = 81 clicks ;70 = 92 clicks ;60 = 107 clicks ;1 = 214 clicks ;0 = 321 clicks
#6
-
Posted 20 February 2011 - 11:22 PM
I need the exact same thing, tried the above script, not working, what do?
#7
-
Posted 29 April 2011 - 09:10 PM
wat do?
*$LCtrl:: Send {control down} While GetKeyState("Lctrl","p"){ Send, {XButton1} } Send {control up} return
The problem lies with "ctrl", specify which side
#8
-
Posted 29 April 2011 - 09:16 PM
Okies, yeah I am playing a game where the cheat is to hold ctrl and press x, but it doesn't add enough xp at later levels so want to hold ctrl and rapid fire the x so it continues to add xp quickly =)
#9
-
Posted 29 April 2011 - 09:21 PM
Not working =/ Now when I hold Lctrl and press x get nothing, but if rapid x manually it adds xp slower. takes like three x clicks for one xp add.
#10
-
Posted 29 April 2011 - 09:24 PM
Not working =/ Now when I hold Lctrl and press x get nothing, but if rapid x manually it adds xp slower. takes like three x clicks for one xp add.
thats because it sends the xbutton, and you arent supposed to press the xbutton either its just lctrl.
Ill change the script based on what you have said
LCtrl & x:: Send {control down} While GetKeyState("Lctrl","p"){ Send, {X} } Send {control up} return
#12
-
Posted 29 April 2011 - 09:31 PM
Game crashed, may be doing it too fast for game to register...sad face. Sorry I'm kinda lame.
Ok so take above script, add sleep 60, press lctrl and x, hold and auto level? Try again I will.
Ok so take above script, add sleep 60, press lctrl and x, hold and auto level? Try again I will.
#13
-
Posted 29 April 2011 - 09:34 PM
Ok, so the script works, but not while I'm in game, if I'm just on my pc then it's no and it ctrl xs all day hard...but not in the game, what do?
#14
-
Posted 29 April 2011 - 09:38 PM
Go on the wiki faq - click "games", read :roll:
#15
-
Posted 29 April 2011 - 10:04 PM