If Statement Trouble

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

If Statement Trouble

Postby niffirg1 » Wed Sep 02, 2009 3:05 am

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
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: If Statement Trouble

Postby Conundrumer » Wed Sep 02, 2009 3:25 am

Check spelling.
User avatar
Conundrumer
 
Posts: 344
Joined: Mon Aug 31, 2009 5:55 pm
Location: NYC

Re: If Statement Trouble

Postby Versieon » Wed Sep 02, 2009 3:39 am

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}
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: If Statement Trouble

Postby Conundrumer » Wed Sep 02, 2009 4:00 am

"onlaserit"
Isn't that an oopsie?
User avatar
Conundrumer
 
Posts: 344
Joined: Mon Aug 31, 2009 5:55 pm
Location: NYC

Re: If Statement Trouble

Postby gradyfitz » Wed Sep 02, 2009 9:59 am

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))

:)
Mechanisms: 18 Mechanisms.
Thyme: Tutorial - Variables/Commands List.
Thymechanic
gradyfitz
 
Posts: 174
Joined: Tue Sep 01, 2009 8:33 am
Location: Victoria, Australia

Re: If Statement Trouble

Postby niffirg1 » Thu Sep 03, 2009 1:38 am

How do you set the If statement to not equal to.
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: If Statement Trouble

Postby Versieon » Thu Sep 03, 2009 1:44 am

=! instead of ==
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: If Statement Trouble

Postby cdh473 » Thu Sep 03, 2009 2:35 am

Versieon wrote:=! instead of ==

lol it's != in C++, not sure about thyme(but thyme is C++ based.)
Please excuse my posts. I am extremely stupid.
User avatar
cdh473
 
Posts: 816
Joined: Tue Sep 01, 2009 12:37 am
Location: Yes

Re: If Statement Trouble

Postby standardtoaster » Thu Sep 03, 2009 3:31 am

-.-

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
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests