XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Variables acting up

01-29-2011, 05:34 AM

After executing the script I replace one value(the y value within the move command ) with a variable that has the same exact number that was there before ".1" I execute it again and I get a different result. I recorded it video qualtiy not that clear :/.

01-29-2011, 09:54 AM
look at the output when you submit: $moveY = .1;

// Result: 0

so therefore $moveY must be an integer. This is why it's not a good idea to initialise or declare your variables without a type (until you know exactly what you're doing)

float $moveY = .1; // the "right" way to do itWhenever you input/submit anything into the script editor unscoped you define it as global. so you defined $moveY as a global int, then referenced it inside a (global!) proc.

and that's why you get a different result.


01-29-2011, 02:21 PM
With one exception:

float $floatArray[] = {1, 2.2, 3.3};

Gives you an integer array instead of an float array because the very first number of the values is an integer.

01-29-2011, 04:59 PM
Ahh ok thx much appreciated

CGTalk Moderation
01-29-2011, 04:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.