Hello, I have been trying, unsuccessfully, to make a speed clicker for idle games the likes of cookie clicker.
As I like to make my own code, I had been trying that at first, but as I quickly noticed that the AHK script language had many specifities I had never encountered so I quickly turned to seeking finished scripts.
I found such scrips, yet none worked the way I desired, and those that claimed they did, did not work at all.
Here is what I wanted : A script that clicks repeatedly on a loop, as I pressed "LButton"
After some messing around and re-writing code, I found out that GetKeyState didn't work properly for me.
If I write
while (GetKeyState("LButton","P"))
{
code here
}
Nothing triggers at all.
If however I enter
while (GetKeyState("LButton"))
{
code here
}
The code triggers Once.
Is my use of "While" wrong? Or am I right in assuming that the parameter "P" for detecting whether my Left Mouse Button is held down doesn't work?
Is there an alternative to GetKeyState?
Update: Might this be a driver issue? AHK is the only application where this is an issue, however:
If I use MButton as a trigger instead of LButton, it works perfectly. Wether using "P" or not.
Anyone have a clue about this?
GetKeyState
GetKeyState
Last edited by Nuarcad on 17 Oct 2017, 05:20, edited 1 time in total.
Re: GetKeyState
Hi
Hope it Help.
Code: Select all
RButton:: ;Enter here your Key
While GetKeyState("RButton", "P"){ ;And here again but let the "P" !
;Start here. ;Enter here your Code
}
return
Re: GetKeyState
Thank you for your reply, this is very close to what I ended up with.Reloaded wrote:Hi
Hope it Help.Code: Select all
RButton:: ;Enter here your Key While GetKeyState("RButton", "P"){ ;And here again but let the "P" ! ;Start here. ;Enter here your Code } return
As I just updated on my first post however, I am starting to suspect drivers to be involved, as the Middle mouse button seems to work just fine, but the left mouse button does not.
Re: GetKeyState
Np for this im here :) head up !Nuarcad wrote:Thank you for your reply, this is very close to what I ended up with.Reloaded wrote:Hi :)
Hope it Help.Code: Select all
RButton:: ;Enter here your Key While GetKeyState("RButton", "P"){ ;And here again but let the "P" ! ;Start here. ;Enter here your Code } return
As I just updated on my first post however, I am starting to suspect drivers to be involved, as the Middle mouse button seems to work just fine, but the left mouse button does not.
Re: GetKeyState
Starting your code with while (GetKeyState("LButton")) will produce intermittent results, depending on the state of the mouse button at the exact instant you run the script.
If it hits the first line when the mouse button is not pressed, it would do nothing. If it hits the line while the mouse button is pressed, it would enter the loop and not leave until the mouse button is released.
If it hits the first line when the mouse button is not pressed, it would do nothing. If it hits the line while the mouse button is pressed, it would enter the loop and not leave until the mouse button is released.
Re: GetKeyState
I see, however any GetKeyState of the left button of my mouse seems compromised, whereas other keys works just fine. (Asides from the lack of parameters in the code if I don't check button state)
Who is online
Users browsing this forum: Google [Bot] and 44 guests