Jump to content
Sign in to follow this  
gui529

Pixel Searching any red.

Recommended Posts

gui529

I been working on a bot for a game. I wanted it to Go back to town once the weapon i use is broken. When a weapon is broken you get a picture of a faded red broken sword on your screen but since its a redish see throught I cant get a fixed color if Im moving.. Is there a way to make bot react to ALL colorations of red in a specific area(not a single dot pixel) ?

;$weaponbrokencolor = PixelGetColor( 250,650 );=======SOME RED PIXEL FROM THE PICTURE
;if $weaponbrokencolor = X then;=======================ANY RED pixel
        
        call("Town")
;endif
Edited by gui529

Share this post


Link to post
Share on other sites
MrMitchell

The HelpFile for PixelSearch has an example of how to search for variations of red in a particular area of the screen...wonder if that could help you?

Share this post


Link to post
Share on other sites
gui529

i looked at it before but i dont really get it....

; Find a pure red pixel in the range 0,0-20,300
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf


; Find a pure red pixel or a red pixel within 10 shades variations of pure red
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000, 100 )
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf

PixelSearch(left,top,right,bottom,color,shadevariation) ....how i set it to ALL red variations

Edited by gui529

Share this post


Link to post
Share on other sites
Qousio

i looked at it before but i dont really get it....

; Find a pure red pixel in the range 0,0-20,300
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf


; Find a pure red pixel or a red pixel within 10 shades variations of pure red
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000, 100 )
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf

PixelSearch(left,top,right,bottom,color,shadevariation) ....how i set it to ALL red variations

Obviously you should pick the red colour that suits you most, and enter a shadevariation. The higher the variation the more colours it will respond to.

You should also keep in mind that a very high shadevariation will also search for other colours, like blue/black/green/yellow etc...

Edited by Qousio

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.