AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Question | How to make the bot click?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Counter-Pro



Joined: 22 Nov 2008
Posts: 5

PostPosted: Thu Jan 08, 2009 7:36 pm    Post subject: Question | How to make the bot click? Reply with quote

Hey, I started to learn AutoHotKey today (beginner), I want to make my own bot for a game.

I want the bot to click.
The Problem is that its only click 1 time and then stop, I have tryed to slove it but AutoHotKey Help, but i don't really understood it.
Can someone please help me to slove it?
Thanks You.

Code:
Code:
MsgBox, 4, ,Click Yes To Get Into The Bot
IfMsgBox, No
    return
; Otherwise, the user picked yes.
MsgBox Press Here To Start Bot.
IfWinExist Fa
{
    WinActivate
}
else
{
MsgBox The Window Is Not Open
}

Send {Control Down}
SetDefaultMouseSpeed, 5
MouseClick, left, 200, 300
SetDefaultMouseSpeed, 5
MouseClick, left, 200, 300
SetDefaultMouseSpeed, 5
MouseClick, left, 200, 300
SetDefaultMouseSpeed, 5
MouseClick, left, 200, 300
Back to top
View user's profile Send private message
tobadyurdead



Joined: 04 May 2008
Posts: 168

PostPosted: Thu Jan 08, 2009 8:49 pm    Post subject: Reply with quote

Okay so first thing is first, you only need to specify the default mouse speed once. And instead of using 5 lines of code to click 5 times in the same spot, you could simply try this
Code:


SetDefaultMouseSpeed, 5 

MsgBox, 4, ,Click Yes To Get Into The Bot
IfMsgBox, No
    return

; Otherwise, the user picked yes.
MsgBox Press Here To Start Bot.
IfWinExist Fa
{
    WinActivate
}
else
{
MsgBox The Window Is Not Open
}

Send {Control Down}

MouseClick, left, 200, 300 ,5 ; the 5 specify's 5 clicks

 


Now for your problem. I "think" what you make be experiencing is your "bot" sending the clicks too fast for the game to read. Try using your original code ( exept only 1 default mouse speed) and implementing a sleep in between clicks, like so
Code:

SetDefaultMouseSpeed, 5
MsgBox, 4, ,Click Yes To Get Into The Bot
IfMsgBox, No
    return
; Otherwise, the user picked yes.
MsgBox Press Here To Start Bot.
IfWinExist Fa
{
    WinActivate
}
else
{
MsgBox The Window Is Not Open
}

Send {Control Down}

MouseClick, left, 200, 300
sleep 500 ;half a second
MouseClick, left, 200, 300
sleep 500
MouseClick, left, 200, 300
sleep 500
MouseClick, left, 200, 300

 
 
Back to top
View user's profile Send private message
Sivvy



Joined: 21 Jul 2008
Posts: 726
Location: Calgary, AB, Canada

PostPosted: Fri Jan 09, 2009 3:49 pm    Post subject: Reply with quote

Code:
MsgBox, 4, ,Click Yes To Get Into The Bot
IfMsgBox, No
    return

; Otherwise, the user picked yes.
MsgBox Press Here To Start Bot.
IfWinExist Fa
{
    WinActivate
}
Else
{
    MsgBox The Window Is Not Open
}

Send {Control Down}
SetMouseDelay, 300
MouseClick, left, 200, 300 ,5

Return

If it doesn't work, or works intermittently, look up "SendMode, Play" and add the word "Play" to the end of the "SetMouseDelay". If it still isn't working properly, increase the number of the delay.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group