Refer to an array using a variable.
I can set them up and read a particular one so
MyArray.3 to look at the 4th item in the MyArray array
but how do I put a variable instead of manually typing in the .3 so i can use code to pick where on the list to look? So
to look up in the list depending on what Variable is.
I’ve tried the format in the wiki help and couldn’t get it to work.
So would StartX look at the second item in the Array StartX. I’m testing to see if I can get it to work. When I set a text object to this it returns [object Object] when i set and object position using it it just disappears - I have two arrays one StartX with value 1 being 90 and same with Start y.
I’ve figure out other ways to solve my problem but I would really like to work out how arrays work.
Hi. We’re going to need to see your code. If you’re seeing “object object” I’m going to assume you’re missing a Variable() or VariableString
Set text = ToString(Variable(StartX))
Set text = ToString(Variable(StartX[Variable(index)]))
Set text = VariableString(StartX)
Set text = VariableString(StartX[Variable(index)])
It disappears with that code
it should be 90.
Thanks for the help
How are you assigning the value to StartX? Is it spelled the exact same ways? Capitalization will get you everytime.
It looks like your ToString() has a lower case t as in toString() It should be capital T.
VariableString(StartX). It’ll return the variable but in a string format.
Urrgh Thanks yes that got the text working sorry I missed that. I got it working with a variable reference as well thanks all.