[SOLVED] Writing a timer with sub-timers

  • Salut,


    I've got two display drawing functions, "DrawDepartures", which is the one to be used normally, and a "DrawIdle", in case there are no trips left in the timetable. "DrawIdle" looks like this:


    and my SimStep and timer function looks like this:


    I've got a main timer (the function RunTimerMain), which just counts down from 10 to 0, then updates the display with one of the two mentioned functions. However, the "DrawIdle" one should cycle between three different modes, within the main timer:


    - Blank (~5-6 seconds)

    - Danish text (2 seconds)

    - English text (2 seconds)


    So, I need a separate timer for the function "DrawIdle", which contains a timer for each display state.


    How could I implement this?


    -Thor

  • Perhaps something like that?:


    Use a "mode" variable, which increases from 0 to 2 each time, the timer runs to 0. If it is 3, set it back to 0. After that you use the mode variable to decide, which text should be shown and which new value of the timer is to be set (5, 2 or 2 ;-) instead of everytime setting it to REFRESH_TIME.

  • thor2950

    Changed the title of the thread from “Writing a timer with sub-timers” to “[SOLVED] Writing a timer with sub-timers”.
  • Newly created posts will remain inaccessible for others until approved by a moderator.

    The last reply was more than 60 days ago, this thread is most likely obsolete. It is recommended to create a new thread instead.

    The maximum number of attachments: 5
    Maximum File Size: 500 kB
    Allowed extensions: bmp, cfg, ini, jpeg, jpg, lct, ldl, llg, lob, log, lpmtl, lptmt, ltx, pas, pdf, png, railtrack, rar, txt, veh, wav