Posted By: PlaystationThree
[Solved] Pointing to variables - 01/09/09 00:16
This is kinda hard to explain in 3dgs terms because its from Adobe Flash's actionscript.
Let's say I have a fer variables: var1 var2 var3.
Say I want to go through all of them in sequence, setting each to a certain value. In actionscript I would do:
while in lite-c you would have to:
Essencially what it does is go through all the vars and sets each to a random number. What the ["var"+i] section does is search for the variable "varX" where X is whatever i is. So if i == 2 then it searches for var2. Can you do something like that in lite-c? I read the sections in the manual about variables but nothing...
Let's say I have a fer variables: var1 var2 var3.
Say I want to go through all of them in sequence, setting each to a certain value. In actionscript I would do:
Code:
function goThrough(number){ var i = 1; while(i<=number){ ["var"+i] = random(10); } } goThrough(3);
while in lite-c you would have to:
Code:
... var1 = random(10); var2 = random(10); var3 = random(10); ...
Essencially what it does is go through all the vars and sets each to a random number. What the ["var"+i] section does is search for the variable "varX" where X is whatever i is. So if i == 2 then it searches for var2. Can you do something like that in lite-c? I read the sections in the manual about variables but nothing...