Jump to content
Sign in to follow this  
gainstaa

Problem with Alt + key

Recommended Posts

gainstaa

Well heres my code, and thanks to all the people who got me this far.

What I want this to do is click, press alt+q, click, repeat

The clicks work perfectly fine, but the alt+q only works like 30% of the time. Is there a way to make it 100% accurate?

If you have any ideas post the code so I can try them out thanks.

HotKeySet("{f10}", "_exit") ;<== F10 to exit

while 1

MouseClick ( "left",30,328)

Sleep(1500) ;<== 1000 is 1 sec, so 5000 is 5 sec of waiting

Send("{Alt down}")

Send("{q}")

Send("{Alt up}")

sleep(500)

MouseClick ( "left",790,328)

Sleep(1500) ;<== 1000 is 1 sec, so 5000 is 5 sec of waiting

Send("{Alt down}")

Send("{q}")

Send("{Alt up}")

sleep(500)

WEnd

Func _exit()

Exit

EndFunc

Share this post


Link to post
Share on other sites
GMK

I have no way to test this, but perhaps in the time that you're waiting between keyboard shortcuts, the game or window isn't active? It sounds like the game isn't receiving the command. Maybe a WinActivate and WinWaitActive command between keyboard/mouse commands would help. (Just throwing out ideas to try.)

Edited by GMK

Share this post


Link to post
Share on other sites
gainstaa

but the window is always active. and i think its just retarded

Share this post


Link to post
Share on other sites
GMK

Maybe adjusting the sleep time would help. Just another idea.

Share this post


Link to post
Share on other sites
gainstaa

i think what it needs to do is hold alt down for 2 seconds, and during that time press q. I cant use the sleep though because it makes the whole program sleep, which doesnt make the games reaction time between buttons change.

So if theres a way to make alt get held down for a length of time without sleeping the entire program than w/e that way is should work.

If u know how to do the above then post the code, thanks.

Share this post


Link to post
Share on other sites
gainstaa

i still havnt fixed it so if anyone can help me plz do

Share this post


Link to post
Share on other sites
qazwsx

put a sleep(1) after the first alt down and see if that helps.

Share this post


Link to post
Share on other sites
ssubirias3

i think what it needs to do is hold alt down for 2 seconds, and during that time press q. I cant use the sleep though because it makes the whole program sleep, which doesnt make the games reaction time between buttons change.

So if theres a way to make alt get held down for a length of time without sleeping the entire program than w/e that way is should work.

If u know how to do the above then post the code, thanks.

Give the following a try. The higher the number the longer the delay. The Help file will explain these in more detail. When I had issues with send keys and/or mouseclicks not working consistently adjusting the two values fixed the problem.

Opt("MouseClickDownDelay", 200)
Opt("SendKeyDelay", 200)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.