Page 1 of 1

If Statement Trouble

PostPosted: Wed Sep 02, 2009 3:05 am
by niffirg1
I have noticed there are subtle differences in thyme from Phun, and yes i finally got Algodoo to work. here is the code
Code: Select all
(e.geom.color == [0,0,0,1] ? {onlaserit = {}} : {})
for some reason it doesnt work

Re: If Statement Trouble

PostPosted: Wed Sep 02, 2009 3:25 am
by Conundrumer
Check spelling.

Re: If Statement Trouble

PostPosted: Wed Sep 02, 2009 3:39 am
by Versieon
no, this is how you shoud do it

{{scene.my.bla == 1} ? {bla} : {bla bla}}

you put the brackets in the wrong spots

{a} ? {b} : {c}

Re: If Statement Trouble

PostPosted: Wed Sep 02, 2009 4:00 am
by Conundrumer
"onlaserit"
Isn't that an oopsie?

Re: If Statement Trouble

PostPosted: Wed Sep 02, 2009 9:59 am
by gradyfitz
niffirg1 wrote:I have noticed there are subtle differences in thyme from Phun, and yes i finally got Algodoo to work. here is the code
Code: Select all
(e.geom.color == [0,0,0,1] ? {onlaserit = {}} : {})
for some reason it doesnt work

A few things :)
  • Spelling Mistake (as pointed out).
  • You forgot to place argument (not sure of the word I'm looking for) interpreters ((e)=>).
  • Although not really an error, sometimes things go wrong if you don't use e.laser.onLaserHit (well, it's easier to tell apart from onHitByLaser (e.geom))

:)

Re: If Statement Trouble

PostPosted: Thu Sep 03, 2009 1:38 am
by niffirg1
How do you set the If statement to not equal to.

Re: If Statement Trouble

PostPosted: Thu Sep 03, 2009 1:44 am
by Versieon
=! instead of ==

Re: If Statement Trouble

PostPosted: Thu Sep 03, 2009 2:35 am
by cdh473
Versieon wrote:=! instead of ==

lol it's != in C++, not sure about thyme(but thyme is C++ based.)

Re: If Statement Trouble

PostPosted: Thu Sep 03, 2009 3:31 am
by standardtoaster
-.-

I'm going to say this one time.

== equal to
>= greater than or equal to
<= less than or equal to
> more than
< less than
!= not equal to