sequence scripting help

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

sequence scripting help

Postby Rideg » Sat Feb 27, 2010 1:01 am

Code: Select all
(e)=>{
    (sim.time - e.geom.controllerAcc) >= scene.my.simtime ? { scene.my.whatever = 1};         e.geom.controllerAcc = sim.time     } : {} }


Well I want to update the variable every {scene.my.simtime} and do it 10 times then have a break concept so this would repeat after 60 seconds.

Any Ideas?? :?:
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: sequence scripting help

Postby Rideg » Sun Feb 28, 2010 11:13 pm

is this even possible? I just need an answer.
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: sequence scripting help

Postby KarateBrot » Sun Feb 28, 2010 11:55 pm

Code: Select all
sim.time % scene.my.simtime == 0 ? { for(10, (i)=>{ scene.my.whatever = 1 }) } : {  }

Theoretically it's possible like above but sometimes it doesn't detect if sim.time % scene.my.simtime is true. Maybe that's because the laser updates at another frequency than sim.time changes. (laser 60 times per second and sim.time 100 times per second)

Code: Select all
sim.time % scene.my.simtime <= 0.01 ? { for(10, (i)=>{ scene.my.whatever = 1 }) } : {  }

is a bit better but it's not perfect, too.

But Kilinich once made some functions for events and triggers and stuff.
Rating: rated 6.7
Filesize: 1.94 kB
Comments: 7
Ratings: 5
download




x % y is the "modulo" btw. if you don't know. It's the remainder of the division x / y
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron