fielmann Posted December 2, 2008 Share Posted December 2, 2008 I'd like to store/save the postion for 20 objects DIM $Planetpos[21] for $i=1 to 20 $X = Random ( 1,20,1) $y = Random ( 1,20,1) $pos[$i] = $X,$Y ; <- LINE DO NOT WORK!!!! next It should looks like: pos[1] = 10 , 10 pos[2] = 15 , 11 pos[1] = 11 , 19 $pos[$i] = $X,$Y ; <- LINE DO NOT WORK!!!! Can anbody help me ? Link to comment Share on other sites More sharing options...
Xenobiologist Posted December 2, 2008 Share Posted December 2, 2008 #include <Array.au3> Dim $Planetpos[20][2] For $i = 0 To 19 $Planetpos[$i][0] = Random(1, 20, 1) $Planetpos[$i][1] = Random(1, 20, 1) Next _ArrayDisplay($Planetpos, 'Positions') Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Andreik Posted December 2, 2008 Share Posted December 2, 2008 Use a bidimensional array or a separator, for example "|". DIM $Planetpos[21] for $i=1 to 20 $X = Random ( 1,20,1) $y = Random ( 1,20,1) $pos[$i] = $X & "|" & $Y ; <- LINE DO NOT WORK!!!! next And when you want to read the coordinates you can use StringSplit(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
fielmann Posted December 2, 2008 Author Share Posted December 2, 2008 #include <Array.au3> Dim $Planetpos[20][2] For $i = 0 To 19 $Planetpos[$i][0] = Random(1, 20, 1) $Planetpos[$i][1] = Random(1, 20, 1) Next _ArrayDisplay($Planetpos, 'Positions') WOW thx 4 your fast and perfect answer ! your are really: 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