Sign in to follow this  
Followers 0
FoLlAnY

Array2D ReDim Problem

6 posts in this topic

Hi!

First, thanx to all contributors of this forum.

So, I have some problems with this code:

CODE
#include <array.au3>

#include <Array2D.au3>

#Include <Misc.au3>

HotKeySet("q", "quit")

$myArray = IniReadSection("highlight.ini", "wpos3")

If @error Then

ToolTip("Error occurred, probably no such section file.", 0, 0)

Sleep(3000)

Exit

EndIf

Dim $myCoords[uBound($myArray)-1][2]

$ac = 0

$ad = 1

$dll = DllOpen("user32.dll")

Do

$myColor = PixelGetColor($myArray[$ad][0], $myArray[$ad][1])

If _IsPressed("01", $dll) Then

ReDim $myCoords[$ac+1][2]

$myCoords[$ac][0] = $myArray[$ad][0]

$myCoords[$ac][1] = $myArray[$ad][1]

_ArrayDisplay($myCoords, "Contents In myCoords", 0, 0)

_ArrayDelete2D($myArray, $ad)

ReDim $myArray[uBound($myArray-1)][2]

_ArrayDisplay($myArray, "Contents In myArray", 0, 0)

If $ac = 95 Then

Exit

EndIf

$ac+= 1

EndIf

If $ad = UBound($myArray) Then

$ad = 0

EndIf

$ad+= 1

Sleep(100)

Until UBound($myArray) = 1

Func quit()

DllClose($dll)

Exit

EndFunc

The code works for a few mouseclicks, then "Array variable has incorrect number of subscripts or subscript dimension range exceeded." So, is there someone who can see whats wrong?!

Thanx!

Share this post


Link to post
Share on other sites



I'm afraid that i dunno the contents of Highlight.ini so i can't test the code. and i don't even know what you want this to do...

Explain a little bit more, and i'll be happy to help.

Share this post


Link to post
Share on other sites

I'm afraid that i dunno the contents of Highlight.ini so i can't test the code. and i don't even know what you want this to do...

Explain a little bit more, and i'll be happy to help.

Ok, ul the files needed <_<

So, in this testscript (I know pixelgetcolor returns a colourvalue;)), when left mouse is clicked It redims $myCoords with +1 row. Then copies the values of $myArray to $myCoords. So far so good. It also deletes the copied row of $myArray and redim $myArray. Thats where the error comes in after awhile.

Hope that info helps..

Share this post


Link to post
Share on other sites

Ok, ul the files needed <_<

So, in this testscript (I know pixelgetcolor returns a colourvalue;)), when left mouse is clicked It redims $myCoords with +1 row. Then copies the values of $myArray to $myCoords. So far so good. It also deletes the copied row of $myArray and redim $myArray. Thats where the error comes in after awhile.

Hope that info helps..

I'm afraid i still don't know what exactly you want your code to do. What is the significance of the INI file, and why are you reading it with one array, then trying to copy the contents to a whole new array which would leave 2 arrays containing the same stuff.

Share this post


Link to post
Share on other sites

I'm afraid i still don't know what exactly you want your code to do. What is the significance of the INI file, and why are you reading it with one array, then trying to copy the contents to a whole new array which would leave 2 arrays containing the same stuff.

Ok, in this testscript.. there are things cut out (other functions that modifies the array). The differens between myArray and myCoords is that when a colour is true (not ispressed as in this script) it saves the coords to myCoords. And there have to be no dupes, therefor I must delete just that row in myArray so it doesnt search for that specific colour at those coordintes anymore. ok?

Share this post


Link to post
Share on other sites

Ok, in this testscript.. there are things cut out (other functions that modifies the array). The differens between myArray and myCoords is that when a colour is true (not ispressed as in this script) it saves the coords to myCoords. And there have to be no dupes, therefor I must delete just that row in myArray so it doesnt search for that specific colour at those coordintes anymore. ok?

Hi,

Problem solved. Thanx anyway.

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