Page 1 of 1

if statment in the color field for spawned objects

PostPosted: Tue Sep 01, 2009 2:48 am
by RaRaMalum
Lets say you have a circle spawner and you want it to add a thyme script to the color field of every circle spawned.
example code:
{{sim.time == 10} ? {[0,0,1,1]} : {[0,0,0,1]}}

The code will work if you type it in manually for an already existing object, but if you ask the spawner to type it in it simply solves the if statment and puts in the value.

So how do I get a spawner to type in the actuall if statment and not just the value?

Re: if statment in the color field for spawned objects

PostPosted: Tue Sep 01, 2009 3:01 am
by KarateBrot
add this to your scene.addCircle()
Code: Select all
color := {{sim.time == 10} ? {[0, 0, 1, 1]} : {[0, 0, 0, 1]}}

Or is the problem a different one?

[edit]
oh ok... just tested it out. now i know what your problem is. so forget about this post. :D
but that's weird... i try to do something else if i have an idea.

Re: if statment in the color field for spawned objects

PostPosted: Tue Sep 01, 2009 3:09 am
by Chronos
it doesnt automatically correct it. if sim.time is over 10 when it spawns, its gonna be black, no exceptions (unless the code is wrong)

if its still doing this when sim.tim ISNT over 10, something wrong then

Re: if statment in the color field for spawned objects

PostPosted: Tue Sep 01, 2009 3:17 am
by KarateBrot
i know what's wrong...

the code is working and it changes the color after 10 seconds, that's no problem BUT that only happens to the latest spawned circle!
so if you spawn 5 circles and now wait the 5. circle will change its color. the other ones stay at black so this seems to be a bug. it's really worth reporting it.