dbnetsoft
RaceResultExchange
RaceResultExchange
  • General
    • Installation
    • Configuration
      • Exporter
      • WebHooks
    • Licensing
  • Operation Modes
    • Photofinish Sync
    • Displayboard
      • Modes
        • Countdown
        • Runtime
        • Passings
        • Timetrial
        • Lap Counter
      • Scripting
      • Brands/Models
        • FDS MLED
          • Scripting
            • Custom Functions
            • Startclock
            • Clock w/ flashing seperators
            • Conditional formatting difftime
            • Clock, Runtime, Gaptime (Globals)
            • Clock, Runtime, Gaptime (Offline)
            • Countdown to planned starttime and then runtime (Globals)
        • ALGE-Timing GAZ/D-Line
          • Scripting
            • Custom Functions
            • Clock
            • Clock w/ flashing seperator
            • Clock, Runtime, Gaptime
    • Triggered Actions
  • Scripting
    • Functions
    • Examples
      • Racemap
    • Globals
      • Variables
      • RR12 Lists
      • HTTP GET JSON
  • Release Notes
  • Frequently asked questions (FAQ)
    • Gap Time Reference is not set from external pushbutton
    • Accents not shown on FDS MLED
Powered by GitBook
On this page
  1. Operation Modes
  2. Displayboard
  3. Brands/Models
  4. FDS MLED
  5. Scripting

Countdown to planned starttime and then runtime (Globals)

PreviousClock, Runtime, Gaptime (Offline)NextALGE-Timing GAZ/D-Line

Last updated 4 months ago

The following script allows to show the countdown to the planned starttime from the contest and then a runtime during the race.

This can be achieved by having the race start TOD and the planned start TOD available in a RR12 list. The actual content of these values depend on your event file setup.

This list is then pulled via RRExchange globals feature periodically into the software.

The pulled global list entries are available as variables in each script then. They are identified by the name of the global. Also you can shortcut to the first row by using .First., e.g. GlobalsName.First.Starttime for a RR12 field named Starttime in a globals list GlobalsName.

{{ 
now = Clock.TimeOfDay.TotalSeconds
plannedStarttime = GlobalsName.First.PlannedStarttime | ToSeconds
actualStarttime = GlobalsName.First.Starttime  | ToSeconds

# Check for if an actual start time is set
if (actualStarttime == 0) 
    # Countdown to planned start time
    
    # Calculate duration until start
    durationUntilStart = plannedStarttime - now
    
    # If duration has elapsed but no actual starttime is present, stay at 0
    if (durationUntilStart < 0)
        durationUntilStart = 0
    end    
    
    # Format countdown time
    displayText = durationUntilStart | FormatRaceResult "HH:Mm:ss"   
   
      # Output countdown in red
    colorString = "Red"
else 
    # Runtime after actual start time
     
     # Calculate runtime since actual start
     elapsedSinceStart = now - actualStarttime
     
      # Format runtime
      displayText = elapsedSinceStart | FormatRaceResult "HH:Mm:ss"
     
      # Output runtime in green
    colorString = "Green"
end

(mled.Color colorString) + (TrimPad displayText 8 "Right")
}}