Bus priority, lights, driving assistance system

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.
  • Hello,


    Although I understood the fire detection system. I encounter some difficulties in programming, indeed, my goal is quite complex, but I will really want to apply it.


    In France, we have a driving aid system that is positioned below the traffic light. This box detects the bus and informs the situation of when it can pass or not, these are security measures.


    I would like to put it on OMSI.
    This is how it works:


    Here, no bus is present, but when the fire is red, the orange diamond is considered a red light :


    Here, the orange diamond flashes, indicating that it detected my bus :


    Here, when the light turns green (error in the image), the orange diamond and blue exclamation point flashes throughout the "Green" :


    And finally, when the light changes to orange, the orange diamond appears in a fixed manner:


    Those are the steps.
    A friend of mine has to model all this, no problem with each form per .o3d file!


    • A file for orange diamond
    • A file for orange diamond and exclamation point blue
    • A file for blue exclamation point


    Same, no worries for my objects published with OmsiObjEdit, I programmed them without any worries.


    But where I block, it's on the scripts, I tried to fiddle as it should, but I still can not, here's where I am:
    SAC.osc :


    SAC_varlist.txt :


    and .sco file :


    Do you have any idea how it works?


    Thanks

    ;)
  • Hi,


    the following implementation should satisfy your requirements--if I interpreted them correctly. Note that, since I have no convenient means of testing it, it may be erroneous.


    Naturally, you will also have to declare the new variables (Diamond, ExclamationPoint) in your var-list file, as well as reference them from your .sco as usual.

  • Hello,


    First of all, thank you very much for your response, it is very nice of you !!

    :thumbsup:


    I conducted multiple tests last night and this morning, but unfortunately, I have reached the orange diamond is affaiche without blinking as TrafficLightApproach only. No blinking, no exclamation point either.


    I put my file var and sco:



    I made a mistake by accident?


    Thank you

    8)
  • Hi,


    according to the script logic, in your scenery object file, the "exclamation point" [mesh] should only be coupled with the ExclamationPoint variable, and, likewise, the "diamond" [mesh] should only be associated with the Diamond variable--not with TrafficLightApproach or any other variable.


    Now, I don't know what the 7 mesh entries in your .sco actually represent, thus I can only show you how my (hypothetical) .sco would look like (assuming all 5 light components--the 3 standard plus the 2 special ones--are individual objects):



    Try modifying your .sco file so that it matches the example. If it still doesn't help, my .osc is probably bugged, and I will have to test it in-game to find out what's wrong.


    By the way, just to ensure that we're both on the same page, here's the "truth table" that the aforementioned .osc implements:



    Would that be correct?

  • What I understood is the following truth table:


    Which would then lead to a script like this:


    With this sco file:

  • Hello,


    Thank you for your very informative answers, I am grateful!


    I tested both methods.


    • That of Unorthodox Paradox suddenly renders the fire inactive. No sign appears, it remains "off" even when the bus is approaching.
    • The faaabiiii method simply crashed my map, I see only the sky of the map, there is surely a problem of script.


    To clarify the situation, here is the picture I want:


    This is what I want.


    After the tests, here is what my .sco file looks like:


    Do you have an idea ?

  • Hi,


    I just noticed that the Timer variable is absent from your var-list. Other than that, I am fairly sure that the script works, as I just tested it (using a conventional M+R object).


    As an aside, if you don't care about the "standard" 3 lights, I can simplify the script so as to not record their respective states (although it shouldn't really matter, performance-wise...).

  • This is curious indeed, I'm running out of ideas.


    Are there any errors recorded in your logfile? Additionally, ensure that the script file only contains the {frame} block I posted initially (since your script in the opening post contained 2 {frame}s, which is incorrect), and no {init} block.

  • MIRACLE! It works !!!!
    My 3d files had some texture worries, which impacted the blow!


    Everything works, but a single and small enough annoying flaw, during the step below:


    The diamond begins to blink, but you really have to approach the fire, limit it beyond it so that it detects me, as if the detection distance was 1 meters. I find it a pity. Yet on my cube object linked to fire, I left a distance of 50m of detection.


    Would you have any idea how to increase this detection distance?


    Thank you for your many helpers, I am sincerely grateful!

    :D
  • You are welcome.


    With regard to the minimum required bus detection distance, I cannot provide a comprehensive answer, as I lack any editor experience whatsoever. I searched a bit around the forum and found that said distance is affected by a

    Code
    1. [approachdist]
    2. numeric value, e.g., 50


    directive, which must be appended below a [traffic_light]'s pertinent (red) [phase]s, within a crossing's .sco.


    If you can read, or don't mind translating from, German, try searching the forums using terms such as "Ampel+Anforderung" (traffic light request). A plethora of useful information on the subject is available out there.

  • Many thanks to you! It was just enough to change the value 0 to the desired number!


    I do not know how to thank you, you helped me a lot! Thanks to you, the realism is pushed to the maximum for my project! I am really grateful !!!

    :thumbsup:

    :thumbup: