i have a variable ‘val’ and 5 arrays ‘roomNums1’ - ‘roomNums5’ i want a script to search one of those arrays … i can get it to search one array but i can’t get it to search the array with the name ‘roomNums+val’
so if val = 2
i want it to search roomNums2
at the moment I’m just telling it to trace the array that I want (for testing purposes) and the script reads:
trace (roomNums[val]);
but that takes the 3rd value in the array and traces it if val = 2
i’m not sure how to add the value of the variable val onto the end of the array’s name so the correct one will be traced
so if i change the code to read
trace(“roomNums”+val);
then if val = 2 then it traces “roomNums2” i need it to trace the values of the array that is called roomNums2 =)
Hi Shuga,
You know, before I posted V4 back to you, I played around with that for quite a while, I knew that splitting the arrays to make the search shorter was one of the issues you needed to solve. Well, I could not work it out at all, I won’t bore you with the different things I tried - all to no avail.
Well done to Jubba, I knew the solution was simple, but it only underlines the fact that this site is brilliant for problem solving and learning.