timing before script.
4 posts • Page 1 of 1
timing before script.
i want to find how to do a timing gap between laser hit each script execute.
I've been searching for a while for it, but i can't find it.
i want to add it to a on laser hit script.:
I've been searching for a while for it, but i can't find it.
i want to add it to a on laser hit script.:
- Code: Select all
(e)=>{
Scene.addCircle({
pos := e.pos;
collideSet := 1;
radius := 0.05;
})
}
- ZHAK
- Posts: 1
- Joined: Tue Mar 02, 2010 9:18 am
Re: timing before script.
There are different ways to do this, the one I use:
You have to declare the variable scene.my.wait with the value *waiting time* in the console first! The waiting time is 40-60 for every sec. So if you want to wait 2 sec. you use the following (First declare the scene.my.wait!)
- Code: Select all
(e)=>{scene.my.wait == *waiting time* ? {*code for spawning etc.*; scene.my.wait := *waiting time*}:{scene.my.wait := scene.my.wait - 1}}
You have to declare the variable scene.my.wait with the value *waiting time* in the console first! The waiting time is 40-60 for every sec. So if you want to wait 2 sec. you use the following (First declare the scene.my.wait!)
- Code: Select all
(e)=>{scene.my.wait == 100 ? {*code for spawning etc.*; scene.my.wait := 100}:{scene.my.wait := scene.my.wait - 1}}
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-

Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: timing before script.
This for example will spawn your circles exactly every second. Change it to anything you want.
@Matten:
Use = instead of :=
- Code: Select all
(e)=>{
sim.time - controlleracc >= 1 ? {
Scene.addCircle({
pos := e.pos;
collideSet := 1;
radius := 0.05
});
controlleracc = sim.time
} : {};
controlleracc > sim.time ? {controlleracc = sim.time} : {}
}
@Matten:
Use = instead of :=

-

KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: timing before script.
You can use my event system for making scheduled tasks.
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests



