Making an object "blink"
4 posts • Page 1 of 1
Making an object "blink"
Hi everyone, I want to make a warning sign on a car's dashboard. I succeeded in making it disappear/appear but this happens instantly and only once. I want to make it beep 2 or as many times as I need and then stay ON until a condition from a laser shuts it DOWN.
This is what the code looks like. (it is put under a onLaserHit textbox)
I must say that I tried something, namely, to put 2 lasers on a circle and spin that circle for as long as I need but it isn't accurate at all. I want a full thymed script please!
So if someone could help me I would very much appreciate it!
PS: I want to include this warning sign on a car with an automatic braking system (and other electronic aids) when it encounters something ahead (the final prototype should be really awesome I think
).
- Code: Select all
scene.my.aidwarn == 1 || scene.my.aidwarn2 == 1 || scene.my.aidwarn3 == 1 ? {
e.geom.color = [0.96, 0.33600003, 0.33600003, 1.0]
} : {
e.geom.color = [0.96, 0.33600003, 0.33600003, 0.0]
}
This is what the code looks like. (it is put under a onLaserHit textbox)
I must say that I tried something, namely, to put 2 lasers on a circle and spin that circle for as long as I need but it isn't accurate at all. I want a full thymed script please!
So if someone could help me I would very much appreciate it!
PS: I want to include this warning sign on a car with an automatic braking system (and other electronic aids) when it encounters something ahead (the final prototype should be really awesome I think
Țăranul se uită la pământ și pământul la țăran..dacă are pământ, dacă nu, atunci nu!

- RpT
- Posts: 11
- Joined: Sun Oct 02, 2011 4:45 pm
Re: Making an object "blink"
Hi, RpT!
I am not sure if I understood what you meant but maybe something like this is what you are looking for.
The number that divides sim.tick determines the blinking frequency. There is 60 ticks per second, depending on sim.frequency.
I am not sure if I understood what you meant but maybe something like this is what you are looking for.
- Code: Select all
color =
{
scene.my.blink ? {
(math.toint(sim.tick / 60) % 2 == 0) ? {
[1, 0.5, 0, 1.0]
} : {
[0.25, 0.125, 0, 1]
}
} : {
[0.25, 0.125, 0, 1]
}
}
The number that divides sim.tick determines the blinking frequency. There is 60 ticks per second, depending on sim.frequency.
-

Ivan - Posts: 203
- Joined: Tue Oct 06, 2009 2:01 pm
- Location: Croatia
Re: Making an object "blink"
Thank you Ivan, it worked 
Țăranul se uită la pământ și pământul la țăran..dacă are pământ, dacă nu, atunci nu!

- RpT
- Posts: 11
- Joined: Sun Oct 02, 2011 4:45 pm
Re: Making an object "blink"
You're welcome!
-

Ivan - Posts: 203
- Joined: Tue Oct 06, 2009 2:01 pm
- Location: Croatia
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests



