My variables disappear :(

About advanced scenes, and the Thyme scripting language used in Algodoo.

My variables disappear :(

Postby oriol1993 » Mon Dec 07, 2009 11:53 am

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!
oriol1993
 
Posts: 11
Joined: Fri Nov 27, 2009 3:41 pm

Re: My variables disappear :(

Postby KarateBrot » Mon Dec 07, 2009 3:02 pm

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.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: My variables disappear :(

Postby oriol1993 » Mon Dec 07, 2009 5:46 pm

I have partly solved my problem, but I don't understand why :problem: ... 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.
oriol1993
 
Posts: 11
Joined: Fri Nov 27, 2009 3:41 pm

Re: My variables disappear :(

Postby standardtoaster » Mon Dec 07, 2009 6:00 pm

This is a known bug with thyme. Variables will sometimes disappear from places such as motorSpeed.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: My variables disappear :(

Postby StephenAlverez » Mon Dec 07, 2009 10:53 pm

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.

Image
User avatar
StephenAlverez
 
Posts: 164
Joined: Wed Sep 30, 2009 2:46 am
Location: Vermont


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 8 guests

cron