Sign in to follow this  
Followers 0
orunu

pause and background clicks

9 posts in this topic

Hello all im new to autoit and im currently making a simple bot for a game. I have everything I need but two things: Background clicks and a pause. here is my code:

Func Startlvl()
Send("{F1}") ; press F1 key put skill here
While 1
MouseClick("Right", 400, 100, 250)
Send("{F2}") ; press F2 key put sit here
Sleep(3000) ; sleep for half a second
WEnd

now the mouse clicking

MouseClick("Right", 400, 100, 250)

How would I turn that into background clicks so it doesn't control your mouse?

And how would I make it so you can press the "P" button and the script will pause?

Thanks,

Orunu

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

First Start off by Reading this: http://www.autoitscript.com/forum/index.php?showannouncement=11&f=2

If you want to send a click to a *Background* - Meaning to a specific window, Then use the ControlClick. This has totally different coords than a normal mouseclick, so go into the autoit help file and look up controlClick.

;pause function
Global $paused
;Sets the pause hotkey
HotKeySet("p", "pause")

Func pause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
EndFunc

~Shakala

PS: Sleep(3000) ; sleep for half a second

This actually sleeps for 3 seconds

1000 = 1 second

2000 = 2 seconds

3000 = 3 Seconds

Edited by Shakala

Share this post


Link to post
Share on other sites

PS: Sleep(3000) ; sleep for half a second

This actually sleeps for 3 seconds

1000 = 1 second

2000 = 2 seconds

3000 = 3 Seconds

yea i no lol i just changed the sleep and forgot to change the text of what it does XD i'll do that now lol

Share this post


Link to post
Share on other sites

Send("{F1}") ; press F1 key put skill here
While 1
MouseClick("Right", 400, 100, 1000)
Send("{F2}") ; press F2 key put sit here
Sleep(500) ; sleep for half a second
WEnd

;pause function
Global $paused
;Sets the pause hotkey
HotKeySet("p", "pause")

Func pause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
    EndFunc

... it still wont pause the script.... i ran the script the first part does what it's supposed to do then i hit P and the script is still running cuz when i put the cursor on a my desktop (off game) it right click a shit ton.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Send("{F1}") ; press F1 key put skill here
While 1
MouseClick("Right", 400, 100, 1000) ; CHANGE THIS HEREEEEEEEEEEE
Send("{F2}") ; press F2 key put sit here
Sleep(500) ; sleep for half a second
WEnd

;pause function
Global $paused
;Sets the pause hotkey
HotKeySet("p", "pause")

Func pause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
    EndFunc

... it still wont pause the script.... i ran the script the first part does what it's supposed to do then i hit P and the script is still running cuz when i put the cursor on a my desktop (off game) it right click a shit ton.

Ah i didn't even look at your code lol, i see your problem... you have it clicking 1000 times... wtf is that???

;pause function
Global $paused
;Sets the pause hotkey
HotKeySet("p", "_pause")

Send("{F1}") ; press F1 key put skill here
While 1
    MouseClick("Right", 400, 100, 1) ; TO THISSSS aND you shold be good. i tested it, and it worked for me, you should have no problems
    Send("{F2}") ; press F2 key put sit here
    Sleep(500) ; sleep for half a second
WEnd


Func _pause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
EndFunc   ;==>_pause

~Shakala

Edited by Shakala

Share this post


Link to post
Share on other sites

hmm thx i found the background clicks thing in the info put it in there but still cant get it to right click

;pause function
Global $paused
;Sets the pause hotkey
HotKeySet("p", "_pause")



Send( "{F1}" ) ;put skill here
While 1
Send("{F2}") ; press F2 key put sit here
ControlClick ( "[Conquer] Raiding Clans", "", 1022, "Right", 1, 505, 389 )
Sleep(500) ; sleep for half a second
WEnd


Func _pause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
EndFunc   ;==>_pause
idk if i dnt have the right controlID or what.....

Share this post


Link to post
Share on other sites

Ah i didn't even look at your code lol, i see your problem... you have it clicking 1000 times... wtf is that???

;pause function
Global $paused
;Sets the pause hotkey
HotKeySet("p", "_pause")

Send("{F1}") ; press F1 key put skill here
While 1
    MouseClick("Right", 400, 100, 1) ; TO THISSSS aND you shold be good. i tested it, and it worked for me, you should have no problems
    Send("{F2}") ; press F2 key put sit here
    Sleep(500) ; sleep for half a second
WEnd


Func _pause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
EndFunc   ;==>_pause

~Shakala

think i might have to go onto forums related to what i doing to fix my final problem so for no i'll stick with the MouseClick but one last question how can i make it so that u have to press a certain button to start the script once u open it like u double click the exe then u have to press one of the F buttons to start it?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

yeah i would just leave it at this

ControlClick("[Conquer] Raiding Clans", "", "", "right", 1, 505, 389)

For the Title, Make sure you are just coppying and pasteing what the autoit window information says.

This should do it

~Shakala

HotKeySet("S", "Start") ;S to Start the program

than put everything into a function

Func Start()

All your code here

Endfunc

Edited by Shakala

Share this post


Link to post
Share on other sites

yeah i would just leave it at this

ControlClick("[Conquer] Raiding Clans", "", "", "right", 1, 505, 389)

For the Title, Make sure you are just coppying and pasteing what the autoit window information says.

This should do it

~Shakala

kk and how would i make it so that once u open the scripts exe u have to press a butten like F11 to make it run?

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  
Followers 0