Browse Search Popular Register Upload Rules User list Login:
Search:
Traffic Light

Image:
screenshot of the scene

Author: ivan

Group: Phunlets

Filesize: 202.45 kB

Date added: 2011-07-31

Rating: 5.5

Downloads: 1322

Views: 934

Comments: 3

Ratings: 2

Times favored: 0

Made with: Algodoo v1.9.8b

Tags:
Semafor,
Ampel,
thyme,
scripted,
stopping car

Scene tag

A simple traffic light based on sim.time.
Last edited at 2011/08/02 13:36:00 by ivan
Please log in to rate this scene
edit
Similar scenes
Title: Traffic Light - Finally Fixed (Algodoo Only)
Rating: 5.7778
Filesize: 75 kB
Downloads: 1239
Comments: 1
Ratings: 3
Date added: 2010/01/09 18:48:02
Made with: Algodoo before v1.8.5
Rating: rated 5.8
download
Title: Automatic Traffic Control
Rating: 6.7273
Filesize: 288.62 kB
Downloads: 5981
Comments: 17
Ratings: 5
Date added: 2016/11/10 04:44:41
Made with: Algodoo v2.1.0
Rating: rated 6.7
download
Title: Thai Traffic light & 7/11 & Ptt gas station
Rating: 5
Filesize: 188.07 kB
Downloads: 892
Comments: 0
Ratings: 1
Date added: 2020/04/10 08:56:38
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Traffic simulation/ thyme traffic lights
Rating: 5.7778
Filesize: 44.06 kB
Downloads: 1280
Comments: 1
Ratings: 3
Date added: 2009/07/01 18:17:12
Made with: Phun
Rating: rated 5.8
download
Title: Thyme Scripted Robotic Spider - T8 Based
Rating: 5
Filesize: 43.95 kB
Downloads: 1312
Comments: 2
Ratings: 1
Date added: 2015/08/29 12:43:40
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Traffic Light
Rating: 5.5
Filesize: 235.59 kB
Downloads: 991
Comments: 0
Ratings: 2
Date added: 2009/09/12 17:27:37
Made with: Algodoo demo
Rating: rated 5.5
download
Do you think you can be able to script my signals?
Yes, wait. I will explain you.
Last edited at 2011/08/02 12:15:33 by ivan
Here is the "color=" part of the script menu of the yellow light:
{((sim.time % 12 > 4 && sim.time % 12 < 6) || (sim.time % 12 > 10 && sim.time % 12 < 12)) ? [1, 1, 0, 1] : [1, 1, 0, 0.2]}

Everything has to be put into {} to be stored as a continous script.

sim.time - a timer that counts how long the scene has been running

(sim.time % 12 > 4 && sim.time % 12 < 6) means: in a period of 12 seconds (0-12, 12-24, 24-36...) more than 4 and less than 6 seconds (4-6, 28-30, 40-42...)

&& = AND

|| = OR

? = IF-THEN

: = ELSE

[1,1,0,1] = [red=1, green=1, blue=0, opacity=1] = yellow
[1,1,0,0] = [red=1, green=1, blue=0, opacity=0.2] = transparent yellow
If you use lasers, for better performance, set the turned off light opacity to 0.

Everything in words:
If in periods of 12 seconds the time is (more than 4 and less then 6) or (more than 10 and less then 12), the color should be yellow, else transparent (no light)

Basis:
{ ( (A) || (D) ) ? [c1] : [c2] } = if A or D are true, the color will be [c1], if not true (else), the color will be [c2]

If it should light once per period, the basis would be:
{ (A) ? [c1] : [c2] }
Last edited at 2011/08/03 08:23:51 by ivan