Game Development Community

it's no work.

by Yue -Rookie Torque 3D- · in Torque 3D Beginner · 09/01/2013 (8:22 am) · 4 replies

$Car = new SimObject()
{
	Force = 100;
	Color = "Red";
	
};

// console
Car.Force // Error.

About the author

http://www.iris3d.tk -Games Studios- <<I do not speak English: I use the google translator>> My goal as a rookie is knowing Torque 3D


#1
09/01/2013 (9:37 am)
echo($Car.Force);//input
100;//output

%f = $Car.Force; if(%f > 50) echo("Force > 50 is " @ %f); else echo("Force < 50 is " @ %f);//input
Force > 50 is 100;//output
#2
09/01/2013 (10:19 am)
Thanks You!

new SimObject(Cars)  
{  
    Force = 100;  
    Color = "Red";  
      
};  


// console  
Cars.Force //No Error.
#3
09/01/2013 (11:23 am)
$Car will be a global variable and will persist throughout the program.

Car (as in new SimObject(car)) is the object Name and will exist as long as the object itself exists.

%Car will be a local variable which will cease to exist outside of the function where it is defined.
#4
09/02/2013 (8:07 am)
If I'm understanding the behavior of global and local variables.