dbnetsoft
RaceResultExchange
Knowledge BaseIDCamProRemoteRedirectRaceResultExchangeScreensProPhotofinish.NET
RaceResultExchange
Knowledge BaseIDCamProRemoteRedirectRaceResultExchangeScreensProPhotofinish.NET
  • 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

Clock, Runtime, Gaptime (Globals)

PreviousConditional formatting difftimeNextClock, Runtime, Gaptime (Offline)

Last updated 6 months ago

The following script allows to show the current clock before the start of the race, a runtime during the race and a gap time to winner as soon as the first athlete finishes.

This can be achieved by having the race start TOD and the winner 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.

{{
# Get current TOD and convert to seconds
now = timespan.Now | ToSeconds

# Fetch race start time and winner time from Globals List and convert to seconds (this way RR12 field can be seconds or HH:mm:ss string
raceStartedAt = GlobalsName.First.Starttime | ToSeconds
winnerFinishedAt = GlobalsName.First.Winnertime  | ToSeconds

# Determine race states
isRaceStarted = raceStartedAt > 0

# Determine output based on is race started or not
if isRaceStarted 
    # Race is started, check for winner time is present    
    isWinnerFinished = winnerFinishedAt > 0

    if (isWinnerFinished)
        # Winnner is finished, show gap time

        # Change color
        mled.Color "Red"

        # Calculate gap time
        timeSinceWinner = now - winnerFinishedAt
        # Output formatted with + sign, trim to 8 places and right-align
        timeSinceWinner | FormatRaceResult "+HH:Mm:ss" | TrimPad 8 "Right"

    else 
        # No winner present, show running time

        # Change color
        mled.Color "Green"

        # Calculate runtime
        timeSinceStart = now - raceStartedAt
        # Output formatted, trim to 8 places and right-align
        timeSinceStart | FormatRaceResult "HH:Mm:ss" | TrimPad 8 "Right"

    end

else 
    # Before Start

    # Switch to White
    mled.Color "White"

    # Output formatted, trim to 8 places and right-align
    now | FormatRaceResult "hh:mm:ss" | TrimPad 8 "Right"


end
}}