d0n Posted August 28, 2006 Share Posted August 28, 2006 I am having trouble making this part of my GUI I want to have a box where i put a number from 1 - 10 and it will auto fill the other box for me, i was wondering if theres a place where you can store a list of stuff then recall it when the number in the box matches a number from the list? Link to comment Share on other sites More sharing options...
d0n Posted August 29, 2006 Author Share Posted August 29, 2006 can each array hold more than one string ?? like this 1 - 500, 600, 700 2 - 600, 700, 800 and so on Link to comment Share on other sites More sharing options...
JaySquared Posted August 29, 2006 Share Posted August 29, 2006 (edited) Would help if you gave us some idea what exactally your trying to do. A second box can easily be hard coded based on the first box's entry. Also, yes arrays can be multi dimensional. Edited August 29, 2006 by JaySquared Aha.. I have unlocked it's secrets.. world domination is within my grasp... Link to comment Share on other sites More sharing options...
d0n Posted August 29, 2006 Author Share Posted August 29, 2006 i have a box where i input numbers depending on the number inside the box i will do some calculation and print it out beside the input box, but the calculation requires 3 different number from a list 1 - 2, 3, 4 2 - 3, 4, 5 and how do you make it store the 2, 3, 4 on number 1?? Link to comment Share on other sites More sharing options...
JaySquared Posted August 29, 2006 Share Posted August 29, 2006 $array[1][0] = 2 $array[1][1] = 3 $array[1][2] = 4 $array[2][0] = 3 $array[2][1] = 4 etc.. $sum = $array[1][0] + $array[1][1] + $arra[1][2] But if your just trying to do something like Input: 1 1+1 1+2 1+3 make your input a variable and run your calculation based on the variable instead of trying to store numbers? Aha.. I have unlocked it's secrets.. world domination is within my grasp... Link to comment Share on other sites More sharing options...
d0n Posted August 29, 2006 Author Share Posted August 29, 2006 i dont quite get what you are doing there what i want is, the user inputs a number say 1 it will then search the list for the values that is for 1 1 - 500, 600, 300 i'll have to store the 3 different numbers as $a, $b, $c and then use it in my calculations or maybe thats what you are saying and i just dont get it :S Link to comment Share on other sites More sharing options...
JaySquared Posted August 29, 2006 Share Posted August 29, 2006 Without any real knowledge of what your wanting your program to do, all I, or anyone else here can do is guess at possible solutions. The number of solutions is pretty much limitless. Larry suggested arrays based on your first post. An array is set of variables linked together basically. AutoIt can handle up to 64 dimensions. Typically you'll only use 2 at the max. Let me explain: 1 Dimensional array Similar to simply listing out a set of friends: Gary, Roger, Ed, Sally each value resides in a certain spot inside the array $friend[0] = Gary $friend[1] = Roger $friend[2] = Ed $friend[3] = Sally 2 Dimensional array Same as 1 Dimensional array, however each spot in the array now can have it's own set of cubbyholes. Think of a contact list Your friend Gary has a wife named Sue and his daughter is Molly Roger's wife's name is Maggie and his son is Sammy Ed's wife's name is Lisa and daughter Samantha Sally's husband is Jeff and son Alfred $friend[0][0] = Sue $friend[0][1] = Molly $friend[1][0] = Maggie $friend[1][1] = Sammy $friend[2][0] = Lisa $friend[2][1] = Samantha $friend[3][0] = Jeff $friend[3][1] = Alfred Now you know that all the sub entries under $friend[0] belong to Gary and so on. Hope this helps you better understand arrays. Aha.. I have unlocked it's secrets.. world domination is within my grasp... Link to comment Share on other sites More sharing options...
d0n Posted August 29, 2006 Author Share Posted August 29, 2006 can 1 array have more than 1 sub entries? $level1[1] = 500, 600, 700? etc? Link to comment Share on other sites More sharing options...
JaySquared Posted August 29, 2006 Share Posted August 29, 2006 No each sub part can only hold one value but by using a 2 dimensional array all of your other values would be linked together for easy location. $level1[1][0] = 500 $level1[1][1] = 600 $level1[1][2] = 700 Get you $input number and then $sum = $level1[$input][0] + $level1[$input][1] + $level1[$input][2] If you want more assistance you will need to provide your code. Aha.. I have unlocked it's secrets.. world domination is within my grasp... Link to comment Share on other sites More sharing options...
d0n Posted August 29, 2006 Author Share Posted August 29, 2006 ok say i have 2 levels $level1[1][0] = 500 $level1[1][1] = 600 $level1[1][2] = 700 $level2[2][0] = 550 $level2[2][1] = 650 $level2[2][2] = 750 how would i recall depending on the level i input the 3 different values to use them? 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