kart442 Posted October 29, 2007 Share Posted October 29, 2007 (edited) I want to add to the $colorADD from the $color array as it loops each time until $colorADD has 64 elements. expandcollapse popup#include <Array.au3> #include <File.au3> Dim $color[64] Dim $colorADD[64] Dim $xa[64] Dim $xy[64] $file1 = "F:4\xy.au3" _FileReadToArray($file1, $xa) If @error Then MsgBox(0, "Error", "Error reading " & $xa) EndIf ;~ While 1 For $i = 1 To $xa[0] $Line = $xa[$i] $xy = StringSplit($Line, " ", 1) $x = $xy[1] $y = $xy[2] $xr1 = $x + 53 $xr2 = $xr1 + 53 $xr3 = $xr2 + 53 $xr4 = $xr3 + 53 $xr5 = $xr4 + 53 $xr6 = $xr5 + 53 $xr7 = $xr6 + 53 $yu1 = $y - 53 $yu2 = $yu1 - 53 $yu3 = $yu2 - 53 $yu4 = $yu3 - 53 $yu5 = $yu4 - 53 $yu6 = $yu5 - 53 $yu7 = $yu6 - 53 ;~ _ArrayDisplay($xy) $color = _ArrayCreate(PixelGetColor($x, $y)) _ArrayDisplay($color) $colorADD = _ArrayCreate($color) _ArrayAdd($colorADD, $color) _ArrayDisplay($colorADD) Next Edited October 29, 2007 by kart442 Link to comment Share on other sites More sharing options...
GaryFrost Posted October 29, 2007 Share Posted October 29, 2007 Not sure why you would need 2 arrays to hold the same thing expandcollapse popup#include <Array.au3> #include <File.au3> Dim $color Dim $colorADD Dim $xa[64] Dim $xy[64] $file1 = "F:4\xy.au3" _FileReadToArray($file1, $xa) If @error Then MsgBox(0, "Error", "Error reading " & $xa) EndIf ;~ While 1 For $i = 1 To $xa[0] $Line = $xa[$i] $xy = StringSplit($Line, " ", 1) $x = $xy[1] $y = $xy[2] $xr1 = $x + 53 $xr2 = $xr1 + 53 $xr3 = $xr2 + 53 $xr4 = $xr3 + 53 $xr5 = $xr4 + 53 $xr6 = $xr5 + 53 $xr7 = $xr6 + 53 $yu1 = $y - 53 $yu2 = $yu1 - 53 $yu3 = $yu2 - 53 $yu4 = $yu3 - 53 $yu5 = $yu4 - 53 $yu6 = $yu5 - 53 $yu7 = $yu6 - 53 ;~ _ArrayDisplay($xy) If IsArray($colorADD) Then _ArrayAdd($colorADD, PixelGetColor($x, $y)) Else $colorADD = _ArrayCreate(PixelGetColor($x, $y)) EndIf _ArrayDisplay($colorADD) Next SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
kart442 Posted October 29, 2007 Author Share Posted October 29, 2007 (edited) Not sure why you would need 2 arrays to hold the same thing expandcollapse popup#include <Array.au3> #include <File.au3> Dim $color Dim $colorADD Dim $xa[64] Dim $xy[64] $file1 = "F:4\xy.au3" _FileReadToArray($file1, $xa) If @error Then MsgBox(0, "Error", "Error reading " & $xa) EndIf ;~ While 1 For $i = 1 To $xa[0] $Line = $xa[$i] $xy = StringSplit($Line, " ", 1) $x = $xy[1] $y = $xy[2] $xr1 = $x + 53 $xr2 = $xr1 + 53 $xr3 = $xr2 + 53 $xr4 = $xr3 + 53 $xr5 = $xr4 + 53 $xr6 = $xr5 + 53 $xr7 = $xr6 + 53 $yu1 = $y - 53 $yu2 = $yu1 - 53 $yu3 = $yu2 - 53 $yu4 = $yu3 - 53 $yu5 = $yu4 - 53 $yu6 = $yu5 - 53 $yu7 = $yu6 - 53 ;~ _ArrayDisplay($xy) If IsArray($colorADD) Then _ArrayAdd($colorADD, PixelGetColor($x, $y)) Else $colorADD = _ArrayCreate(PixelGetColor($x, $y)) EndIf _ArrayDisplay($colorADD) NextIf I could get array $color to "add" the new element for each loop and keep the previous element also that would be great....Can you help? Didn't notice the changes you made at first...Thanks, but now how to get it to stop at 64 elements then start over "empty". Edited October 29, 2007 by kart442 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now