Laser data script problem

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

Laser data script problem

Postby Nxdt » Sun Sep 06, 2009 9:11 pm

I'm tring to get a laser to send a unique code to another object. Thecode is unique to the laser and the object will change color if that laser is fired on it.

I'm using the fadeDist variable to encode the lasers data but the scripts are not working.
Code: Select all
(e)=>{e.laser.fadedist == 1001.0  ?  {e.geom.color = [1, 1, 1, 1]}  }
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!

Re: Laser data script problem

Postby Versieon » Sun Sep 06, 2009 10:03 pm

The problem is you didn't write the if staement corectly.

its {a} ? {b} : {c}
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: Laser data script problem

Postby Frank » Mon Sep 07, 2009 12:21 am

question ? {true} : {false};

It doesn't seem to parse right if it doesn't have a false case. You can just leave the false section empty. If you want it to do nothing if the statement is false, just do

(e)=>{e.laser.fadedist == 1001.0 ? {e.geom.color = [1, 1, 1, 1]} : {} }
Made some cool stuff a long time ago
User avatar
Frank
[Best Tutorial Maker 2010]
 
Posts: 193
Joined: Mon Aug 31, 2009 6:37 pm
Location: the dark side of the moon

Re: Laser data script problem

Postby Nxdt » Mon Sep 07, 2009 5:03 pm

Thanks, i'll see if it works.
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!

Re: Laser data script problem

Postby Sniperkasa » Mon Sep 14, 2009 8:29 pm

did it work?
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem :)
User avatar
Sniperkasa
 
Posts: 493
Joined: Tue Sep 01, 2009 5:34 pm
Location: The bottom of a lake.


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron