what's wrong ?

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

what's wrong ?

Postby hiltropper » Fri Jan 07, 2011 12:46 am

sorry for that little maybe stupid question but i tried out every possible way to write it down that i could imagine - it doesnt work right

code for onLaserHit
Code: Select all
(e)=>{e.geom.immortal = true ? {scene.my.v3 = "immortal"} : {scene.my.v3 = "mortal"}}


scene.my.v3 used for a display as shown text

problem: everytime it changes from zero to true ("immortal") but not to false ("mortal") (even if geom is not immortal)
i also tried to set another variable in front of the if function ,not directly the .e.geom.immortal.. nothing changed
what is the problem? is it because of the boolean value? no problems with integer values and "greater than's"
thanks for help :thumbup:
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: what's wrong ?

Postby davidz40 » Fri Jan 07, 2011 3:03 pm

For comparing, You need to use == instead of =.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: what's wrong ?

Postby hiltropper » Fri Jan 07, 2011 6:41 pm

could you show me a example code for my special case with true/false? it works that way in other cases but not that one :D
Code: Select all
(e)=>{e.geom.texture == "gold" ? {scene.my.v2 = "gold"} : {e.geom.texture == "ice" ? {scene.my.v2 = "eis"} : {scene.my.v2 = "undef."}}}

that works
but
Code: Select all
(e)=>{e.geom.immortal == true ? {scene.my.v2 = "immortal"} : {scene.my.v2 = "mortal"}}

not.
thanks
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: what's wrong ?

Postby Kilinich » Fri Jan 07, 2011 9:35 pm

e.geom.immortal == true is the same as e.geom.immortal
so in onLaserHit/onHitByLaser event code should work fine:

e.geom.immortal ? {} : {}
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: what's wrong ?

Postby electronicboy » Sat Jan 08, 2011 12:29 am

I can't check this as im on a mobile device but

Code: Select all
(e)=>{e.geom.immortal == True ? {scene.my.v3 = "immortal"} : {scene.my.v3 = "mortal"}}


Notice that the word True, has the first character capitalised.

You can use killinich's method but i thought that i'd point out that the first character is capitalised.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: what's wrong ?

Postby hiltropper » Sat Jan 08, 2011 5:04 am

thank you ,everythings clear :thumbup:
now i know what was wrong sounds logic
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 7 guests