Page 1 of 1

Laser data script problem

PostPosted: Sun Sep 06, 2009 9:11 pm
by Nxdt
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]}  }

Re: Laser data script problem

PostPosted: Sun Sep 06, 2009 10:03 pm
by Versieon
The problem is you didn't write the if staement corectly.

its {a} ? {b} : {c}

Re: Laser data script problem

PostPosted: Mon Sep 07, 2009 12:21 am
by Frank
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]} : {} }

Re: Laser data script problem

PostPosted: Mon Sep 07, 2009 5:03 pm
by Nxdt
Thanks, i'll see if it works.

Re: Laser data script problem

PostPosted: Mon Sep 14, 2009 8:29 pm
by Sniperkasa
did it work?