Jump to content
Sign in to follow this  
asan

Script not quick enough

Recommended Posts

asan

Ok just remember im a total newb and after trying and trying finally came up with something that is almost there.

It seems to be working right it just doesnt seem to be clicking the pixel as soon as it finds it, I need it to click as soon as it finds it

and also do I really need a msg box every time it finds it. I'd love to take that out. Someone please help me tweak this

HotKeySet('{esc}', '_Exit')
While 1
    Global $iColor = 0xE4EBFF
$coord = PixelSearch( 11, 78, 539, 779, $iColor )
If Not @error Then
MouseClick("left", $coord[0], $coord[1])
sleep(500)
MouseClick("left", $coord[0], $coord[1])
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
WEnd
Func _exit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites
jaberwacky

Ok just remember im a total newb and after trying and trying finally came up with something that is almost there.

It seems to be working right it just doesnt seem to be clicking the pixel as soon as it finds it, I need it to click as soon as it finds it

and also do I really need a msg box every time it finds it. I'd love to take that out. Someone please help me tweak this

HotKeySet('{esc}', '_Exit')
       While 1
           Global $iColor = 0xE4EBFF
       $coord = PixelSearch( 11, 78, 539, 779, $iColor )
       If Not @error Then
       MouseClick("left", $coord[0], $coord[1])
       sleep(500)
       MouseClick("left", $coord[0], $coord[1])
       MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
       EndIf
       WEnd
       Func _exit()
           Exit
       EndFunc
How about this?

HotKeySet("{esc}", "_Exit")

Global $iColor = 0xE4EBFF

While 1
    sleep(100)
    
    $coord = PixelSearch( 11, 78, 539, 779, $iColor )
    
    If Not @error Then
        MouseClick("left", $coord[0], $coord[1],2,0)
        ConsoleWrite("X and Y are:" & $coord[0] & "," & $coord[1])
    EndIf
WEnd

Func _exit()
    Exit
EndFunc

edit: code edit

edit: 2nd code edit

edit: used"

[autoit][/autoit]
instead of:
[code]
Edited by jaberwocky6669

Share this post


Link to post
Share on other sites
Spiff59

I guess he doesn't like mouse-clicking to close a MsgBox every time he gets a hit, and ConsoleWrite certainly might be what he would prefer. I don't know how he needs his output presented, or intends to use it, but he might also consider tooltip as an option. You could easily place the tooltip at the location of the found pixel as well.

Edited by Spiff59

Share this post


Link to post
Share on other sites
asan

How about this?

HotKeySet("{esc}", "_Exit")

Global $iColor = 0xE4EBFF

While 1
    sleep(100)
    
    $coord = PixelSearch( 11, 78, 539, 779, $iColor )
    
    If Not @error Then
        MouseClick("left", $coord[0], $coord[1],2,0)
        ConsoleWrite("X and Y are:" & $coord[0] & "," & $coord[1])
    EndIf
WEnd

Func _exit()
    Exit
EndFunc

edit: code edit

edit: 2nd code edit

edit: used"

[autoit][/autoit]
instead of:
[code]

Thank you works perfect now

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  

×