if then or if then- problem

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

if then or if then- problem

Postby KaLul » Mon Nov 16, 2009 11:22 pm

hey i got a problem.
what am i making wrong?


Keys.bind
(
"a", {scene.my.var == 0.5} ? {scene.my.Var = 0}
||
{scene.my.var == 0 ? scene.my.var 0.5}
)



i want that:
if i press "a"
and var = 0,5
then it should be 0
but if it is 0
it should be 0.5...
:?:
can someone help?
Image
User avatar
KaLul
 
Posts: 29
Joined: Fri Sep 11, 2009 8:14 pm

Re: if then or if then- problem

Postby standardtoaster » Mon Nov 16, 2009 11:32 pm

Code: Select all
Keys.bind("a", {scene.my.var == 0.5 ? {scene.my.var = 0} : {scene.my.var == 0 ? {scene.my.var = 0.5} : {}}})
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: if then or if then- problem

Postby KaLul » Mon Nov 16, 2009 11:49 pm

ok... well....
that doesnt work... i think thats cause if scene.my.var = 0 , it has not longer to do with scene.my.var.
because it is 0!!!
damn... i want the attraction of an object change by pressing. how can i do that?
Image
User avatar
KaLul
 
Posts: 29
Joined: Fri Sep 11, 2009 8:14 pm

Re: if then or if then- problem

Postby standardtoaster » Tue Nov 17, 2009 12:09 am

I tested it and it works. In the attraction part of the script menu on an object put {scene.my.var} in there.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: if then or if then- problem

Postby KaLul » Tue Nov 17, 2009 12:23 am

wow thanks^^ ive forgotten the {} ind my object.
Image
User avatar
KaLul
 
Posts: 29
Joined: Fri Sep 11, 2009 8:14 pm

Re: if then or if then- problem

Postby KarateBrot » Tue Nov 17, 2009 12:43 am

attention!
do not bind keys with scripting if you want to upload the files to algobox because you will change the config settings of the users that download and open your scene. it's the same with the water particle changes you wanted to make. that would be really annoying
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 8 guests