Double Command

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

Double Command

Postby HavingPhun » Tue Jul 05, 2011 4:06 am

I have already asked this but I still need some help. I am wondering how to make a thyme command do more than one thing. Like:

Code: Select all
onhitbylaser (e)=>{e.laser.maxrays < 2 ? {e.geom.color = e.laser.color}:{e.geom.color = e.geom.color}};{e.geom.color = e.laser.color}}}


How do I make a thyme command do 2 things. Also how do I dynamicly change the color of lasers with scene.my variables?

Thank You!
I won't be on the forums much for a while. But maybe once in a while.
User avatar
HavingPhun
 
Posts: 178
Joined: Sun Feb 06, 2011 10:42 pm

Re: Double Command

Postby TC42 » Tue Jul 05, 2011 5:05 am

Thyme commands are separated by semicolons. ex... scene.my.example = 100; scene.my.exampleII = 42
You don't need the extra brackets.
Right:
Code: Select all
(e)=>{scene.my.example = 13; scene.my.otherexample = 42}


Wrong:
Code: Select all
(e)=>{{scene.my.example = 13}; {scene.my.otherexample = 42}}
(e)=>{{scene.my.example = 13} {scene.my.otherexample = 42}}


It is relatively easy to debug using the console if you mess up...

Laser color changing is done by substituting variables for values in the color array(s)-- ex...
color = {[0,0, scene.my.blue, 1]}
colorHSVA = {[scene.my.hue, 1, 1, 1]}
color = {scene.my.color}
colorHSVA = {scene.my.colorHSVA}
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests