Sign in to follow this  
Followers 0
frontmill

two dimensional array question

5 posts in this topic

hey guys, i've got a (probably kind of stupid) question about how to define a 2 dimensinal array. This is the function i need it for, i used dim, but that doesnt seem to work. please help me :whistle: . Thanks in advance!

func _scanareacolor($i_xleft,$i_yupper,$i_xright,$i_yunder,$i_color)
 $xpointer = $i_xleft
 $ypointer = $i_yupper
 $ystop = $i_yunder + 1
 dim $check
 While $ypointer <> $ystop
  $color = PixelGetColor($xpointer,$ypointer)
  if $color = "000000" Then
   $check[$ypointer][$xpointer] = 1
  Else
   $check[$ypointer][$xpointer] = 1
  EndIf
  If $xpointer = $i_xright Then
   $ypointer = $ypointer + 1
   $xpointer = $i_xleft
  Else
   $xpointer = $xpointer + 1
  EndIf
 WEnd
Return $check
EndFunc

Share this post


Link to post
Share on other sites



look in the help under dim


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

yeah i already read that, but i still don't get it. The help file only speaks of a way to give a value to variable right away, like this:

Dim $Grid[4][4]=[["Paul", "Jim", "Richard", "Louis"], [485.44, 160.68, 275.16, 320.00]]

but it doesnt say anything about what im trying to do.

Share this post


Link to post
Share on other sites

dim $check[a number here][another number here]

for example, dim $check[2][2] would create an array that can store data at

$check[0][0]

$check[0][1]

$check[1][0]

$check[1][1]

make sense?

Share this post


Link to post
Share on other sites

I don't understand what you are trying to do with your setup. But by the Function name, I am going to assume you are trying to get all the specific colors found in a region. If that is the case, try this. http://www.autoitscript.com/forum/index.ph...st&p=266683


[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

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