Kiti Posted December 28, 2009 Posted December 28, 2009 Hello! How can I turn this: Global $array1[5] = ["A","B","C","D","E"] Global $array2[5] = [1,2,3,4,5] into this? Global $array3[5][2] = [["A",1],["B",2],["C",3],["D",4],["E",5]] Thank you in advance! Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30
PsaltyDS Posted December 28, 2009 Posted December 28, 2009 (edited) Use Ubound() to get the size of the arrays, Global/Local to create the new 2D array, then one For/Next loop nested inside the another to copy the data from the two 1D arrays into the new 2D array. Take a shot at it and post your code if you need more help. Edited December 28, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Kiti Posted December 28, 2009 Author Posted December 28, 2009 (edited) My mind tells me to write this: #include<array.au3> Global $array1[5] = ["A","B","C","D","E"] Global $array2[5] = [1,2,3,4,5] $s = UBound($array1) global $array3[$s][2] for $i = 0 to $s $array3[$i][1] = $array1[$i] $array3[$i][2] = $array2[$i] next _arraydisplay($array3) ...but (of course) it's not right ) Any ideea about what can be wrong? Edit: I've got it, it has to be: for $i = 0 to $s -1 $array3[$i][0] = $array1[$i] $array3[$i][1] = $array2[$i] next Thank you a lot for your help!!! Happy New Year! Edited December 28, 2009 by Kiti Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30
PsaltyDS Posted December 28, 2009 Posted December 28, 2009 Glad you got it. Happy New Year! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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