Sign in to follow this  
Followers 0
jmnc2

Arrays

6 posts in this topic

#1 ·  Posted (edited)

Global $CardsTheySelectedCSA[33];[3];used in trade by value

Local $x

For $x = 1 To 32

$CardsSelectedCSA[$x] = _ArrayCreate (_ArrayCreate (0,0),0,0)

Next

size = 0

$CardsSelectedCSA[0] = size

$t = $CardsSelectedCSA[2][0][1] ;y will this not work

$t = (($CardsSelectedCSA[2])[0])[1] ; or this

$t = $CardsSelectedCSA[2]

$t = $t[0]

$t = $t[1] ;this works but it is a pain as it takes 3 lines. is this the only way to do it

Edited by jmnc2

Share this post


Link to post
Share on other sites



and what is your question? -.-


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

Is there a way to make this "$t = $CardsSelectedCSA[2][0][1]" line work without resorting to the 3 lines method?

Share this post


Link to post
Share on other sites

Hm i dont understand what you exactly want to do


--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

I'm lost too...I don't know what you're trying to do; therefore, impossible for me to help.

We could help you if you would add more detail to your in-script comments or include all of the code.

Dim $lines,$Display, $NumCols
$lines = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"
;---------------------------------------------------------------------
;Lets convert a comma delimited string into a single dimension array
;---------------------------------------------------------------------
$Columns = StringSplit($lines, ",")
$NumCols = $Columns[0]
MsgBox(0,"Calculate # of Dimensions", " How many: " & $Columns[0])
;---------------------------------------------------------------------
;Lets build a multidimensional Array with enough columns
;---------------------------------------------------------------------
Dim $array[2][ $Columns[0] ]
For $i = 1 To $Columns[0]
    $array[1][$i-1] = $Columns[$i]
Next
;---------------------------------------------------------------------
;Display comma delimited string to a multidimensional Array
;---------------------------------------------------------------------
For $j = 1 To $NumCols
    $Display = $Display & "array[1]["&String($j-1)&"]" & @Tab & " = " & @Tab & $array[1][$j-1] & @CRLF
Next
MsgBox(4096, "Your Multidimensional Array",$Display)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Sorry the arrays were meant to have the same name. I should of tryed compiling it before posting sorry.

I was trying to do this:

#include 'array.au3'
Global $array[33]
Local $x

$array[0] = Random ( 2 , 32 ,1)

For $x = 1 To $array[0]
$array[$x] = _ArrayCreate (_ArrayCreate (0,Random ( 2 , 32 ,1)),0,0)
Next

MsgBox(4096, "Last random number", $array[$array[0]][0][1])

got this error

C:\Program Files\AutoIt3\Examples\Mbot\t.au3 (12) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

MsgBox(4096, "Last random number", $array[$array[0]][0][1])

MsgBox(4096, "Last random number", ^ ERROR

so I did this:

#include 'array.au3'
Global $array[33]
Local $x

$array[0] = Random ( 2 , 32 ,1)

For $x = 1 To $array[0]
$array[$x] = _ArrayCreate (_ArrayCreate (0,Random ( 2 , 32 ,1)),0,0)
Next

$t = $array[$array[0]]
$t = $t[0]
MsgBox(4096, "Last random number", $t[1])

This works but is there a way to avoid using the $t and do it all in the function pass like I tried in the first example?

Edited by jmnc2

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