Sign in to follow this  
Followers 0
dre111

Confused with pixel search

12 posts in this topic

hey im trying to make a script that sends numpad3 every like half a second, while searching for a yellow color, and when it gets this yellow color in the certain area, itll stop. i can make it send the numpad3 and stuff, but im a little sketchy with the do until and pixelsearch functions, any1 wanna help a newb out?

Share this post


Link to post
Share on other sites



hey im trying to make a script that sends numpad3 every like half a second, while searching for a yellow color, and when it gets this yellow color in the certain area, itll stop. i can make it send the numpad3 and stuff, but im a little sketchy with the do until and pixelsearch functions, any1 wanna help a newb out?

always glad to help. welcome to the forums. what do you have already?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i have really little done, and im completely stumped cause this is my first/second time doing something like this. (i know im a really big newb :P )

HotKeySet("{ESC}", "Terminate")

;;;;;
Do
    Sleep("500")
    Send("{NUMPAD3}")
Until ***CONFUSED HERE***
;;;;;;;;

Func Terminate()
       Exit 0
EndFunc

i need to know what to use, i need it to keep hitting numpad3 and then when it detects this yellow color, then itll stop, and i can make it send the numpad3, but im so confused with the do until and if i am even supposed to use this, sorry for being so bad. lol

Edited by dre111

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

HotKeySet("{ESC}", "Terminate")
Dim $Topx = 0
Dim $Topy = 0
Dim $Bottomx = 300
Dim $Bottomy = 200
Dim $Color = 0xFFFF00
;;;;;
Do
    $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color)
    Sleep("500")
    Send("{NUMPAD3}")
Until $Pix <> 1
;;;;;;;;

Func Terminate()
       Exit 0
EndFunc

Edit:

['/code] would have been nice for me!! :P

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

thanks alot, im going to try it, if any1 else has suggestions or has a good place for tutorials, please let me know :P

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

How about this-

$send = 1
Local $Pix1 = PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0xE0ECE8, 10)
While 1
if $send = 1
    Send("{Num1}")
Sleep(500)
endif
If $Pix1 <> 1  Then
    If IsArray($Pix1) Then 
$send = 0
 Else

    endif
Wend

It's slopy, but hopefully helpful.

Edited by =sinister=

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

i entered it correctly, it runs with no errors, but its not detecting the color when it passes by, heres my code

HotKeySet("{ESC}", "Terminate")
Dim $Topx = 440
Dim $Topy = 297
Dim $Bottomx = 496
Dim $Bottomy = 317
Dim $Color = 0xDAB966
;;;;;
Do
    $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color)
    Sleep("500")
    Send("{NUMPAD3}")
Until $Pix <> 1
;;;;;;;;

Func Terminate()
       Exit 0
EndFunc

EDIT: i didnt see urs sinister, lemme try that.

i used toe window information thing but it still isnt finding it, ill try to fix it

Edited by dre111

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

uh, the color is correct in my script. Your on your own there. sry. BUT, I have a script that can get the color. I need to fix it, so when it's fixed, I will post it.

**edit**

There was an error in my script, edited and fixed. So if theres in error, try recopying it.

Edited by =sinister=

Share this post


Link to post
Share on other sites

Here is the program

hotkeys-

pause- exit

insert- make mouse color background

home- copy to clipboard

-enjoy

Color_Program.au3

samples.bmp

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

i entered it correctly, it runs with no errors, but its not detecting the color when it passes by, heres my code

HotKeySet("{ESC}", "Terminate")
Dim $Topx = 440
Dim $Topy = 297
Dim $Bottomx = 496
Dim $Bottomy = 317
Dim $Color = 0xDAB966
;;;;;
Do
    $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color)
    Sleep("500")
    Send("{NUMPAD3}")
Until $Pix <> 1
;;;;;;;;

Func Terminate()
       Exit 0
EndFunc

EDIT: i didnt see urs sinister, lemme try that.

i used toe window information thing but it still isnt finding it, ill try to fix it

I thought you might run into a problem here, my apologies for not point something out.

Using AutoInfo Tool, there are 2 options you have to look at:

1. Options\Coord Mode - I generally will use Client Coords - So when using an Opt("CoordMode") option... I would set my coord paramater to 2, but window coords would be 0, and screen is default at 1.

2. Options\Color Mode - Default is RGB, make sure it is on the Default when trying to locate your colour Hex or Dec.

Opt("PixelCoordMode", 2); Step 1 above, may need to change the 2
Opt("SendKeyDelay", 1); Just incase you need to send quickly, you may want to send slower

HotKeySet("{ESC}", "Terminate")
Dim $Topx = 440
Dim $Topy = 297
Dim $Bottomx = 496
Dim $Bottomy = 317
Dim $Color = 0xDAB966
;;;;;
Do
    $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color)
    Sleep("500")
    Send("{NUMPAD3}")
Until IsArray($Pix)
;;;;;;;;

Func Terminate()
       Exit 0
EndFunc

Good Luck!

@=sinister= ; you could have just showed the pixel portion, with a simple #include at the top :P

Edit:

@Larry - Wonderful idea...>> Until IsArray($Pix) --- Changed it in script above to that.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

oh, right... Lol....

Share this post


Link to post
Share on other sites

thank you smoke, that worked, thanks a bunch for all your help every1 :P

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