Jump to content

A harder question with pixels I think..


Recommended Posts

Hello guys again...

I studied the pixel commands but none of them seems to suit me...

What I'd like to do is to have my script check 1-2 pixels if they are colored with a certain color (in this case with red, and when I say red I mean almost any shade of red)

and if this is true, execute a command.

The problem is I can't make a script for checking 1-2 pixels whole the time if they are red.

Anyone could help me out plz?

Link to comment
Share on other sites

Hello guys again...

I studied the pixel commands but none of them seems to suit me...

What I'd like to do is to have my script check 1-2 pixels if they are colored with a certain color (in this case with red, and when I say red I mean almost any shade of red)

and if this is true, execute a command.

The problem is I can't make a script for checking 1-2 pixels whole the time if they are red.

Anyone could help me out plz?

You can just check both pixels like this

$p1col = pixelgetcolor($x,$y)
$p2col = pixelgetcolor($x+1,$y)
if InRange($p1col) and Inrange($p2col) then somethingtodo()

func InRange($icol)
Return  $icol >= $minRED and $icol <= $maxRED
endfunc

More difficult, I imagine, to decide what $minRED and maxRED are. What does a shade of red mean? I suppose you could say that it is a colour where the red componnet is larger than the blue and larger than the green components. So perhaps you could do this

Func IsItRedish($iCol)
$rr = BitAnd($iCol,0xff0000)/0x10000
$gg = BitAnd($icol,0x00ff00)/0x100
$bb = BitAnd($icol,0x0000ff)
if $rr > $bb and $rr > $gg then return True

return False

But I don't know if a colour which returns true from that always looks red, probably not.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

from my code

If PixelGetColor(26, 577 + $resolution) > 16777150 And PixelGetColor(26, 577 + $resolution) < 16777214 And PixelGetColor(35, 571 + $resolution) > 16777150 And PixelGetColor(35, 571 + $resolution) < 16777214 And PixelGetColor(53, 567 + $resolution) > 16777150 And PixelGetColor(53, 567 + $resolution) < 16777214 Then
Sleep(500)
EndIf

Grabs pixels from multiple locations and allows a range of a specific color

~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Link to comment
Share on other sites

Ok, first of all thx for all the comments I should look through them and try to make a brand new script and see if it works.

I specify my needs now..

I think I should just use pixelsearch, get a value, and check if it is red or not, just as you guys explained, but considering I don't really know how hex and decimal color system works I can not really define the shades of red.

Any tips how should I define the range of my red?

Link to comment
Share on other sites

If I'm executing this, than I get an error message saying :

$p1col = pixelgetcolor($433,$456)

$p1col = pixelgetcolor(^ ERROR

Error: variable used without being declared

What Am I doing wrong ?:/

Sleep(5000)

Opt("MouseCoordMode", 2) 

Func IsItRedish($iCol)
$rr = BitAnd($iCol,0xff0000)/0x10000
$gg = BitAnd($icol,0x00ff00)/0x100
$bb = BitAnd($icol,0x0000ff)
if $rr > $bb and $rr > $gg then return True

return False

Endfunc 


$p1col = pixelgetcolor($433,$456)
if InRange($p1col) then 
    Mouseclick ("left")
Endif
func InRange($icol)
Return  $icol >= $minRED and $icol <= $maxRED
Endfunc



While 1 

WEnd
Link to comment
Share on other sites

Sleep(5000)

Opt("MouseCoordMode", 2)

Func IsItRedish($iCol)

$rr = BitAnd($iCol,0xff0000)/0x10000

$gg = BitAnd($icol,0x00ff00)/0x100

$bb = BitAnd($icol,0x0000ff)

if $rr > $bb and $rr > $gg then return True

return False

Endfunc

While 1

$p1col = pixelgetcolor(433,456)

if IsItRedish($p1col) = true then

Mouseclick ("left")

Endif

Sleep (5000)

WEnd

It is working now, but not for red only :/ almost for every color except black.. any ideas?

Link to comment
Share on other sites

well when i got all the colors for FFXI I used a screen shot utility because print screen did not show the right colors for some reason and this utility was spot on.

Then I take the screen shot and open in JASC PAINT SHOP PRO.

From then you can use the eye dropper thing to pickup the color and when you view what the color is it will tell you the hex value.

Ill try to find that screen print util

~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Link to comment
Share on other sites

OK but let me see any red close to what you need and I will post a range and we will see if it works ;)

I had to do this in FFXI because of translucency and because for some odd reason a Nvidia card will display a color slightly different then an ATI card. That was one of the first things I figured out when a bunch of people said their bot wasnt working and I finally narrowed it down to the video card.

~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Link to comment
Share on other sites

  • Moderators

OK but let me see any red close to what you need and I will post a range and we will see if it works :D

I had to do this in FFXI because of translucency and because for some odd reason a Nvidia card will display a color slightly different then an ATI card. That was one of the first things I figured out when a bunch of people said their bot wasnt working and I finally narrowed it down to the video card.

You narrowed down Pixel variation colors for programming to a video card? ;) I can understand the bit difference (16 bit versus 32 bit), but what you just said made no sense to me, guess I better go do some homework.

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.

Link to comment
Share on other sites

You narrowed down Pixel variation colors for programming to a video card? ;) I can understand the bit difference (16 bit versus 32 bit), but what you just said made no sense to me, guess I better go do some homework.

Yeah when I first started making bots I noticed when I didnt give a range of colors and only a specific color it was only working for people with an ATI card.

I got this by asking people to post their system specs which was easy because in my gui I used directx to display their computer setup.

From there is was only a matter of time before I noticed a trend.

Also how do you not know ati displays things slightly differently then nvidia ?

http://www.pureoverclock.com/article647.html

Well, the truth of the matter is that NVIDIA and ATI/AMD do things differently at both the hardware and software (driver) levels, and in the past this has caused much controversy with regards to overall image quality -- video cards are not created equal.

~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Link to comment
Share on other sites

  • Moderators

Yeah when I first started making bots I noticed when I didnt give a range of colors and only a specific color it was only working for people with an ATI card.

I got this by asking people to post their system specs which was easy because in my gui I used directx to display their computer setup.

From there is was only a matter of time before I noticed a trend.

Also how do you not know ati displays things slightly differently then nvidia ?

http://www.pureoverclock.com/article647.html

I think you're confusing visual display with bitmap display... But eh..

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.

Link to comment
Share on other sites

Waku your pixel is @ 400x300 and its closer to brown

Red 172

Green 80

Blue 29

Hex #ac501d

Int 11356958

I would use 11000000 to 115000000

See if that works

Edited by burners

~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...