My variables disappear :(
5 posts • Page 1 of 1
My variables disappear :(
In my scene, there is some hinges that the value motor is managed by a variable {for exemple scene.my.tu}, and I have two sets of hinges. Nothing happens with the activated hinges with the value true, but the ones which are disabled with the value false, when I save the scene and I open it again, the variable in the hinges scripting box turns into the word "false" and not the variable :S. The same happens with some boxes which show the value of the variable {"" + scene.my.distance}
Any idea?
Thank you!
Any idea?
Thank you!
- oriol1993
- Posts: 11
- Joined: Fri Nov 27, 2009 3:41 pm
Re: My variables disappear :(
be sure to always type the code between { } brackets because they are telling algodoo that there's a variable between and not only a constant.
And check the variable values. you can only have integer and float values for motors. if somewhere NaN appears the hinge will be deleted (but that's not your case. i just want to mention it). maybe your motor speed variable is no integer or float value.
Or another reason for it could be the case that your variable is not declared and not saved to the scene. that means if you save it your variable will be ignored and at reloading it's not in the scene anymore, causing an error and throwing the code out.
To prevent that declare the variable with := and not only with =. so instead of typing scene.my.tu = 0 (or whatever) into the console type in scene.my.tu := 0.
And check the variable values. you can only have integer and float values for motors. if somewhere NaN appears the hinge will be deleted (but that's not your case. i just want to mention it). maybe your motor speed variable is no integer or float value.
Or another reason for it could be the case that your variable is not declared and not saved to the scene. that means if you save it your variable will be ignored and at reloading it's not in the scene anymore, causing an error and throwing the code out.
To prevent that declare the variable with := and not only with =. so instead of typing scene.my.tu = 0 (or whatever) into the console type in scene.my.tu := 0.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: My variables disappear :(
I have partly solved my problem, but I don't understand why ... I tried to declare the variables and do what you said and the problem still happens.
The value of the variable is given by a condition, in pause I give the value to the variable "true", and then if I save when I open it's in the same state. If I try to do the same with the value "false" it doesn't work...
Any idea?
Thank you anyway.
The value of the variable is given by a condition, in pause I give the value to the variable "true", and then if I save when I open it's in the same state. If I try to do the same with the value "false" it doesn't work...
Any idea?
Thank you anyway.
- oriol1993
- Posts: 11
- Joined: Fri Nov 27, 2009 3:41 pm
Re: My variables disappear :(
This is a known bug with thyme. Variables will sometimes disappear from places such as motorSpeed.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: My variables disappear :(
With motors, it may not be a bug. Lets say the variable was scene.my.on and you want it on the hinge speed, now, if you turn on motor, than put speed to zero so it doesn't start moving when you don't want it to. This will erase any variable you put in. To fix it, or to fix it with a speed of zero rpm, go back into the script menu and turn on motor, even if the speed is zero, and even if the motor says its on in the hinge menu. This happens because when you turn on the motor and put it's speed to zero, it regesters as a brake not a motor, like if you put atoubrake on. Hope this helps.
I am Alpha and Omega, the beggining and the end.
-
StephenAlverez - Posts: 164
- Joined: Wed Sep 30, 2009 2:46 am
- Location: Vermont
5 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest