I want to make a Stopreporter with scroll from right to left

Willkommen in der OMSI-WebDisk!
Als Gast kannst du nur Inhalte in deiner ausgewählten Sprache sehen. Registrierte Nutzer können die Sichtbarkeit anderer Sprachen in ihrem Kontrollzentrum aktivieren, weitere Infos hier.
Alle Themen sind in den Foren mit einer Sprachflagge gekennzeichnet: = Englisch [EN], = Deutsch [DE], = Französisch [FR]. Wenn du die angegebene Sprache nicht beherrschst, schreibe auf Englisch!
  • 1. Which program has the problem? (Main application, editor, SDK tool, etc.)


    >Main application




    2. Please describe the problem in as much detail as possible. What happened or could cause the error?


    >I made some code on my IBIS system, and I want to make a Stopreporter font that scrolls from right to left.


    But this does not work!


    I need some help =(




    3. Please add a log file to your post, which can be a spoiler, code block or file attachment.



    4. If there is a problem with a screenshot, you can upload it and include it in the post attachment.

    未提供相片說明。

    The above text is fixed =(

    Einmal editiert, zuletzt von JCLeung215 ()

  • Anzeige
  • A dynamic text isn't possible in OMSI.


    You can only create a textbox, as an object. And this one should be animated. However, the margin (of your display or something else) must be exactly as wide as the text box, otherwise, the text box is visible out of the display.



    I hope you understand my bad english ^^

  • A dynamic text isn't possible in OMSI.


    thats not true. you can easily develop a scrolling text in OMSI. even a pixel-perfect one.


    JCLeung215

    I've checked your script and there are a few issues i found. Without checking the complete script, i can only evaluate the segment you posted. first of all, a value in OMSI isn't exactly zero or one at any time because OMSI is using floating point numbers. you should always use bigger > or smaller < operations instead of "=" while dealing with changing values, unless you put them in yourself. So you can do a 1 (S.L.YourVariable) and it will work just fine if you check the variable later with e.g. (L.L.YourVariable) 1 =. Everything thats a floating value like Timegap or your wheels roation or stuff like that will most likely never be zero or one. Also, try to rethink your script and check for logic errors. as an example, the following script wont work due to a few reasons:


    (L.L.rtime) 0 >

    (L.L.rtime) 2 < &&

    {if}

    (L.L.rtime) 0 =

    (L.L.rlocation) 1000 >

    {if}

    0 (S.L.rlocation)


    first of all, if you check if rtime is bigger than zero and smaller than two, the next statement (L.L.rtime) 0 = will never be true because this scriptpart is only calculated if rtime is bigger than zero. Also, you forgot an && or || behind (L.L.rlocation) 1000 >, so (L.L.rtime) 0 = is ignored.


    after that it seems like you try to step over the text by one space 100 times; so the text will scroll once every frame. this will technically work just fine. however, there are a few issues. lets say you only have 20 frames per second, this code is only executed 20 times a second; so for your two second counter, you can only step over the text 40 times. to get this to work, you need to call the macro every frame and you also need to set Refresh_Strings to 1 every frame. besides that, you never set your rtime counter back to zero; so the script would only work once and the counter would count up to infinity if you haven't set this variable back to zero somewhere else in the script.


    I've modified your code in a way that it should scroll permanently exactly 100 times, so it will add 100 spaces behind the text and then it will start from the beginning as long as its called every frame. It will take 100 frames to do so.


    Q5wJXwm.png


    To make this work more realistic, a few more steps would be needed. first, check the font settings in your model.cfg. there are settings to automatically center the font and stuff like that, make sure your settings fit your needs. Also,you have to compensate for the framerate using a timegap, not only for the counter itself. lets say the string moves over by 10 characters a second, you cant simply say "yeah, from 0 to 1 second, step over 10 times"; you would need to get the current frametime and check how far it should move over every frame. on a fast computer with like 200fps on grundorf, the script would take only half a second to complete. on a slower machine with 100 fps, it would take a second. for 50 fps, it would take two seconds and for 10 fps it would take 10 seconds. so on a slow machine with only 10 fps, the steps to move over would need to be bigger and you would need to add more spaces every frame.
    so, in theory, you can make this work without any issues if you fix some problems here and there.

    HOWEVER:

    You should never use a string modification for scrolling a text. this will result in massive lags and it may cause other issues like blinking or invisible text, especially while using scripttextures. A much better solution - at least from a performance point of view - is to just animate the textbox itself horizontally. you could cut it in different pieces and hide/unhide them using scripts or you can hide the textbox with a transparent face and a bit of cheating using the rendering order.

  • Moderator

    Hat das Thema freigeschaltet