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

Views: 591

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 Control System
Rating: 5.8182
Filesize: 17.05 kB
Downloads: 997
Comments: 5
Ratings: 5
Date added: 2009/10/09 11:24:12
Made with: Algodoo demo
Rating: rated 5.8
download
Title: THYME traffic simulation with Traffic Lights (UPDATED AGAIN)
Rating: 8.52
Filesize: 85.81 kB
Downloads: 7371
Comments: 10
Ratings: 19
Date added: 2009/12/27 01:14:20
Made with: Phun
Rating: rated 8.5
download
Title: Automatic Traffic Control
Rating: 6.7273
Filesize: 288.62 kB
Downloads: 5265
Comments: 17
Ratings: 5
Date added: 2016/11/10 04:44:41
Made with: Algodoo v2.1.0
Rating: rated 6.7
download
Title: Traffic Light
Rating: 6.8333
Filesize: 29.35 kB
Downloads: 449
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: 381
Comments: 1
Ratings: 1
Date added: 2016/01/18 20:27:38
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Thyme Scripted Robotic Spider - T8 Based
Rating: 5
Filesize: 43.95 kB
Downloads: 600
Comments: 2
Ratings: 1
Date added: 2015/08/29 12:43:40
Made with: Algodoo v2.1.0
Rating: rated 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