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: 1326

Views: 938

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: 1244
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: THYME traffic simulation with Traffic Lights (UPDATED AGAIN)
Rating: 8.52
Filesize: 85.81 kB
Downloads: 8718
Comments: 10
Ratings: 19
Date added: 2009/12/27 01:14:20
Made with: Phun
Rating: rated 8.5
download
Title: Thai Traffic light & 7/11 & Ptt gas station
Rating: 5
Filesize: 188.07 kB
Downloads: 898
Comments: 0
Ratings: 1
Date added: 2020/04/10 08:56:38
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Traffic Light
Rating: 6.8333
Filesize: 29.35 kB
Downloads: 700
Comments: 0
Ratings: 6
Date added: 2008/07/05 18:21:18
Made with: Phun
Rating: rated 6.8
download
Title: Traffic Laws
Rating: 5
Filesize: 414.22 kB
Downloads: 751
Comments: 1
Ratings: 1
Date added: 2016/01/18 20:27:38
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Traffic Light
Rating: 5.5
Filesize: 235.59 kB
Downloads: 996
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