Jump to content

Compare And Pinpointing Values


Recommended Posts

First of all, let me say that i completly suck at arrays, so if someone could help me make an array for this code i'd be most greatfull...

$poss1=274
$poss2=162

$var1 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var2 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var3 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var4 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var5 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var6 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var7 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var8 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var9 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var10 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var11 = PixelGetColor( $poss1, $poss2 )
sleep (500)
$var12 = PixelGetColor( $poss1, $poss2 )
MsgBox(0,"2041386", $var1&@LF& $var2&@LF& $var3&@LF& $var4&@LF& $var5&@LF& $var6&@LF& $var7&@LF& $var8&@LF& $var9&@LF& $var10&@LF& $var11&@LF& $var12 )

Now... this will gather colorinformation from a specific spot on the screen. What i need to do is compare all these variables and pinpoint the color displayed the most and the one displayed the least.

In other words, if a window aprears for 1 second within that spot, 2 variables will have another colorinfo compared to the others and i want to know how many of the variables contains this new specific color (for how many seconds did this window apear in that spot).

I can't use any windows API or Au3 functions to detect the window since this is within D3D.

Edited by faldo
Link to comment
Share on other sites

  • Moderators

Well from here you can do If/Then or whatever, but everything will be stored in $DisplayFind...

Opt('PixelCoordMode', 2); May need to change the 2 to 0 or 1, check the help file to see
Dim $var[13], $poss1 = 274, $poss2 = 162, $DisplayFind = ''
For $i = 1 To UBound($var) - 1
    $var[$i] = PixelGetColor($poss1, $poss2)
    $DisplayFind = $DisplayFind & '0x' & Hex($var[$i], 6) & @LF
    If $i < (UBound($var) - 1) Then Sleep(500)
Next
$DisplayFind = StringTrimRight($DisplayFind, 1)
MsgBox(0, '2041386', $DisplayFind)

;An Array of the colors found
$DisplayFind = StringSplit($DisplayFind, @LF)
For $x = 1 To UBound($DisplayFind) - 1
    MsgBox(0, 'Test', $DisplayFind[$x])
Next

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

Waoh... impressive :)

I just remember why i suck at arrays... because they're so damn hard to understand :mellow:

Thanx alot for the array mate... not that i understand how "Dim" worx or why you use that "UBound" thingie =)

Edited by faldo
Link to comment
Share on other sites

  • Moderators

With Dim you are declaring the variable in a scope... Ubound you are returning the size of the array :)

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

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...