Question; Traffic light with blinking phase?

Das Forum befindet sich im reduzierten Betrieb. Die Addon- und Supportforen bleiben weiterhin verfügbar.
Bitte beachte, dass OMSI nicht mehr weiterentwickelt wird. Ein Teil der Entwickler widmet sich inzwischen der Entwicklung eines neuen Simulators. Weitere Informationen zum LOTUS-Simulator findest Du hier.
Ein communitybetriebenes Nachfolge-Forum wird hier verlinkt, sobald es gegründet und bereit ist.
  • Hi guys,


    I got a question.
    I'm currently desiging a traffic light, but I want something which I didn't achieve yet.
    So here is my traffic light;


    Negenoog Rechtdoor Knipperend


    Ampel2.osc


    Ampel2_varlist.osc


    So what I want to achieve is that as soon as Phase 3 get's active, the light starts to blink, until Phase 8 is reached, then the orange light will show and after red will show.
    This is an existing Dutch traffic light for buses and trams. Red is standard. After that it turns to white and starts to blink. After that the light turns Orange and after that Red again.
    Can someone help me? I don't know what I'm doing wrong.. I thought this should work..
    Thanks in advance!

    LetsRepaintIt - At your service!
    http://www.letsrepaintit.com/

  • So you want a white blinking instead of green. This should be possible with a script, but I don't see the problem at the moment.


    There is an alternative like in the Vienna Addon. They have green blinking. They changed the traffic light configuration of the crossing objects. Instead of giving phase 6, they set phase 6 and phase "off" changing every 0.x seconds.

    Payware-Addon "Berlin X10" ist fertig.


    Als Download-Version, Box-Version, Special-Edition und bei Steam erhältlich.

  • Hi, yes!
    That's exactly what I'd like.
    Right now 'wit' is replacing 'green'.
    But I also want this object to suite with every map so that you don't have to change the crossing.
    Do you know where the problem is in my script above? I only want to let it blink by script..
    Thanks

    LetsRepaintIt - At your service!
    http://www.letsrepaintit.com/

  • The first problem is that you're defining two frame-segments via the {frame} command.
    I don't think that this is possible and even if it is, it doesn't make any sense.


    The second thing is that you don't use the correct script syntax.
    For example the line "(L.L.TrafficLightPhase) (S.L.Wit) =" can never work like that.
    S.L.xxx is for writing to variables and L.L.xxx is for reading.
    So if you want to compare two variables you'd have to use L.L.xxx on both.
    Also, the variable "Wit" contains a boolean value, meaning it's either true (1) or false (0).
    Comparing this to the TrafficLightPhase also doesn't make any sense at all.


    I'm not sure if I understood you correctly but maybe this is what you want:


    When the "Wit" Phase is active, it will make the "Wit" light blink with a 0.5 sec. interval (you can change that of course if you like).

  • Thank you very much!
    This was exactly what I'm looking for!
    It's working just perfect now!


    The thing with these scripts is this;
    At school I learned to script with if and else, but OMSI has a weird way of writing scripts.
    First of all you define what needs to happen for the IF to become active
    Everything below IF will happen if the things in front of IF are right.
    Thanks, this script explained a lot for me! This topic can be locked!

    LetsRepaintIt - At your service!
    http://www.letsrepaintit.com/

  • I do have a small notice;


    As soon as the period of "Wit" has ended, the lights still show up even though they shouldn't be.
    So first run; everything works fine, but when the total crossing runs for the second time, the white lights stay active..

    LetsRepaintIt - At your service!
    http://www.letsrepaintit.com/

  • Another question;


    This object has got tiny lights (2.8 cm).
    They are so tiny, they almost can't be spotted from long distance.
    Is there any way I can improve the light strength?
    Changing the factor in the .o3d file does't make a difference.


    Regards, Thomas

    LetsRepaintIt - At your service!
    http://www.letsrepaintit.com/

  • SchulterSack, thank you for your solution. I used your script to make the green light go on and off once every half a second. But I need some more help from you. It's probably because of the strange script syntax or am I missing something.
    In the varlist file, I see, that Red, Yellow, Green and Off are defined. Actually, I added Off to the end. Initially, they were red, yellow, green. I defined Off in the .sco file of the lights. So my script now looks like this:



    Questions:
    1. Where is Timegap defined and what is it for? Is it a variable? I searched with Sublime with ctrl+shift+f in the folder, where are the files of the trafficlights and it finds only this in a couple of files: (L.S.Timegap)
    In this script, you seem to be using it in a sum operation, but how if not declared?
    2. (the main question) How to make the green light flash like this only during the last 3 seconds before it turns yellow? This is what I would like to achieve.
    3. I could not find out what do those numbers mean? What is s0, l0 and TrafficLightPhase. You check in the if-statements in the script like this:
    if l0 is between 0 and 5 then flash red, if it is between 3 and 5 or 9 and 11 then yellow. What does 11 mean, 6, 3 mean? They seem not to be seconds to me.


    (L.L.Off) (L.S.Timegap) + (S.L.Off) 0.5 > Here, I cannot determine what exactly do you compare to 0.5?
    (L.L.Green) ! (S.L.Green) Here, something should be not equal to something, I guess?


    If there is a manual, probably it would be easier for you to share a link to it, so I can find the answers myself.

    :)


    Thank you!

    :)
  • Hi,


    most of your questions can be answered by reading the wiki article about the OMSI scripting system. You can find it here.
    "Timegap" contains the time (in seconds) since the last frame, so by adding this up you can make a timer or countdown (which is why the variable was named "Timer" in my original script ;)).
    "TrafficLightPhase" contains the index of the current traffic light phase of the linked crossing object.
    These are both system variables, they are declared and set by OMSI itself. You can find a list and details about them here (in German, but it's mostly pretty self-explanatory).


    To answer your main question:
    In my opinion, the best way to do this would be to add one or multiple separate "blinking phases" in the traffic light editor.
    If you own the Vienna add-on, you should have a look at their traffic lights, since they did exactly what you're trying to achieve.
    You could also use a timer to count the duration of the green phase, but I'm not sure this will work properly.

  • I did the blinking green a while back. This is the setup I used:


    Seasonic SSR-650TD; Intel Core i5-6600K 3,5GHz; Gainward GTX 1060 6GB Phoenix GS; 2x Kingston HyperX Fury 8GB; 2x Seagate Barracuda 2TB; 2x 24" AOC I2481FXH; Windows 8.1

  • I did the blinking green a while back. This is the setup I used:



    Thank you both! Etrusan, your solution seems to be exactly what I need, except that I have to modify the values somehow, because right now, it turns red at the moment it should turn green. Stays red for 3-4 seconds, then red and yellow for only one second, then 5-6 seconds green, then 4 or 5 seconds flashing green and then it turns yellow (not flashing) and stays yellow during the remaining of the normal green phase and during the whole red phase and turns red at the moment it should turn from red-yellow to green. I just tested it on an RQ_2spur_6,5_junct object.
    Other than that, I found out myself, that those phases are to be set to the .sco file of the junction object the traffic-lights are linked to, not the traffic-lights themselves. I say this just in case someone else like me is wondering where to put those settings for phases.


    eidt: Ahaa, I just reminded myself once again what I have seen during the test 10 minutes ago and when I "link" it to the values, I think I see a pattern, which makes me think, that those values are actually the time in seconds for the particular phase to last. For example, phase 0 will last for 4.99999992153375 seconds, phase 3 will last for 0.99999998430675 seconds and so on. I will test it.