JavaScript Extensions

The TeamLINQ JavaScript Extensions are a series of functions that replace the native SimHub JavaScript functions in the dash editor, while taking advantage of all of TeamLINQ’s features.

Table of contents
  1. Download & Usage
  2. Helper
    1. Convert String to TimeSpan
  3. Player
    1. Get Player Leaderboard Position
    2. Get Current Lap Sector Time
    3. Get Last Lap Sector Time
    4. Get Session Best Lap Sector Time
    5. Get Best Split Time
    6. Get Best Sector Time
  4. Session
    1. Get Leaderboard Car Class Count
  5. Opponents
    1. Check Driver Available
    2. Check If Driver Is Player
    3. Get Driver Name
    4. Get Driver ID
    5. Get Driver Car Number
    6. Get Driver Car Name
    7. Get Driver Current Lap
    8. Get Driver Current Lap High Precision
    9. Get Driver Best Lap
    10. Get Driver Last Lap
    11. Get Driver Current Sector
    12. Get Driver Sector Current Lap
    13. Get Driver Sector Last Lap
    14. Get Driver Sector Best
    15. Get Driver Sector Best Lap
    16. Get Driver Class Position
    17. Get Driver Car Class
    18. Get Driver Car Class Color
    19. Get Driver Car Class Text Color
    20. Get Driver Category (ACC ONLY)
    21. Get Driver iRating (iRacing ONLY)
    22. Get Driver License String (iRacing ONLY)
    23. Get Driver Position Gain
    24. Get Driver Class Position Gain
    25. Get Driver Track Position Percent
    26. Get Driver Delta To Player
    27. Get Driver Delta To Best
    28. Get Driver Gap To Player
    29. Get Driver Gap To Leader
    30. Get Driver Gap To Class Leader
    31. Get Driver Relative Gap To Player
    32. Get Driver Relative Distance To Player
    33. Check If Driver Car Is In Pit
    34. Check If Driver Car Is In Pit Lane
    35. Check If Driver Car Is In Garage
    36. Get Driver Pit Count
    37. Get Driver Laps Since Last Pit Out
    38. Get Driver Last Pit Duration
    39. Get Opponent Leaderboard Position Ahead/Behind
    40. Get Opponent Leaderboard Position Ahead/Behind Class Only
    41. Get Opponent Leaderboard Position Player Class Only

Download & Usage

To use these functions, copy the file into your dashboard’s JavascriptExtensions folder.

Download JS Extensions

Helper

Convert String to TimeSpan

ld_stringToTimespan()

Converts a TimeSpan string to a TimeSpan Object.

Player

Get Player Leaderboard Position

ld_getplayerleaderboardposition()

Returns the leaderboard position of the current player.

Get Current Lap Sector Time

ld_currentlapgetsectortime(sector, includePreviousSectorsTime = true)

Returns the time of the given sector (sector starting from 1). When includePreviousSectorsTime is true the value cumulates the previous sectors.

Get Last Lap Sector Time

ld_lastlapgetsectortime(sector, includePreviousSectorsTime = true)

Returns the time of the given sector for the last completed lap (sector starting from 1). When includePreviousSectorsTime is true the value cumulates the previous sectors.

Get Session Best Lap Sector Time

ld_sessionbestlapgetsectortime(sector, includePreviousSectorsTime = true)

Returns the time of the given sector for the session best completed lap (sector starting from 1). When includePreviousSectorsTime is true the value cumulates the previous sectors.

Get Best Split Time

ld_getbestsplittime(sector)

Returns the best sector split time of the session (sector starting from 1).

Get Best Sector Time

ld_bestsectortime(sector, includePreviousSectorsTime = true)

Returns the best sector time of the given sector (sector starting from 1). When includePreviousSectorsTime is true the value cumulates the previous sectors.

Session

Get Leaderboard Car Class Count

ld_getleaderboardcarclasscount()

Returns how many car classes are available on the leaderboard.

Opponents

Check Driver Available

ld_driveravailable(position)

Returns true for the race position if a driver is available (when available).

Check If Driver Is Player

ld_driverisplayer(position)

Returns true for the race position if the driver is the actual player (when available).

Get Driver Name

ld_drivername(position)

Returns for the race position the driver’s name (when available).

Get Driver ID

ld_driverid(position)

Returns for the race position the driver’s unique id (when available).

Get Driver Car Number

ld_drivercarnumber(position)

Returns for the race position the driver’s car number (when available).

Get Driver Car Name

ld_drivercarname(position)

Returns for the race position the driver’s car name (when available).

Get Driver Current Lap

ld_drivercurrentlap(position)

Returns for the race position the driver’s current lap (when available).

Get Driver Current Lap High Precision

ld_drivercurrentlaphighprecision(position)

Returns for the race position the driver’s guessed lap in the race including the actual lap percent (when available).

Get Driver Best Lap

ld_driverbestlap(position)

Returns for the race position the driver’s best lap time (when available).

Get Driver Last Lap

ld_driverlastlap(position)

Returns for the race position the driver’s last lap time (when available).

Get Driver Current Sector

ld_drivercurrentsector(position)

Returns for the race position the driver’s current sector (starting from 1) (when available).

Get Driver Sector Current Lap

ld_driversectorcurrentlap(position, sector, includePreviousSectorsTime = true)

Returns for the race position and the sector (starting from 1) the driver’s current lap sector time. When includePreviousSectorsTime is true the value cumulates the previous sectors.

Get Driver Sector Last Lap

ld_driversectorlastlap(position, sector, includePreviousSectorsTime = true)

Returns for the race position and the sector (starting from 1) the driver’s last completed lap sector time. When includePreviousSectorsTime is true the value cumulates the previous sectors.

Get Driver Sector Best

ld_driversectorbest(position, sector, includePreviousSectorsTime = true)

Returns for the race position and the sector (starting from 1) the driver’s session best sector time. When includePreviousSectorsTime is true the value cumulates the previous sectors.

Get Driver Sector Best Lap

ld_driversectorbestlap(position, sector, includePreviousSectorsTime = true)

Returns for the race position and the sector (starting from 1) the driver’s best lap sector time. When includePreviousSectorsTime is true the value cumulates the previous sectors.

Get Driver Class Position

ld_driverclassposition(position)

Returns for the race position the driver’s position in his own class (when available).

Get Driver Car Class

ld_drivercarclass(position)

Returns for the race position the driver’s car class (when available).

Get Driver Car Class Color

ld_drivercarclasscolor(position)

Returns for the race position the driver’s car class color, provided by iRacing, autoassigned otherwise (when available).

Get Driver Car Class Text Color

ld_drivercarclasstextcolor(position)

Returns for the race position the driver’s car class text color, white or black to be readable over car class color (when available).

Get Driver Category (ACC ONLY)

ld_drivercategory(position)

Returns for the race position the driver’s category, ACC only (when available).

Get Driver iRating (iRacing ONLY)

ld_driveriracingirating(position)

Returns for the race position the driver’s iRating (when available).

Get Driver License String (iRacing ONLY)

ld_driverlicencestring(position)

Returns for the race position the driver’s license string (when available).

Get Driver Position Gain

ld_driverpositiongain(position)

Returns for the race position the driver’s position gain since the start of the race/connection (when available).

Get Driver Class Position Gain

ld_driverpositiongainclass(position)

Returns for the race position the driver’s position gain in his own class since the start of the race/connection (when available).

Get Driver Track Position Percent

ld_drivertrackpositionpercent(position)

Returns for the race position the driver’s track position, 0.0-1.0 (when available).

Get Driver Delta To Player

ld_driverdeltatoplayer(position)

Returns for the race position the driver’s delta to the current player best lap (when available).

Get Driver Delta To Best

ld_driverdeltatobest(position)

Returns for the race position the driver’s delta to the opponent’s best lap (when available).

Get Driver Gap To Player

ld_drivergaptoplayer(position)

Returns for the race position the driver’s gap to the player (when available).

Get Driver Gap To Leader

ld_drivergaptoleader(position)

Returns for the race position the driver’s gap to the leader (when available).

Get Driver Gap To Class Leader

ld_drivergaptoclassleader(position)

Returns for the race position the driver’s gap to his own class leader (when available).

Get Driver Relative Gap To Player

ld_driverrelativegaptoplayer(position)

Returns for the race position the driver’s relative gap to player (when available).

Get Driver Relative Distance To Player

ld_driverrelativedistancetoplayer(position)

Returns for the race position the driver’s relative distance to player (when available).

Check If Driver Car Is In Pit

ld_driveriscarinpit(position)

Returns for the race position if the driver’s car is in the pit (when available).

Check If Driver Car Is In Pit Lane

ld_driveriscarinpitlane(position)

Returns for the race position if the driver’s car is in the pit lane (when available).

Check If Driver Car Is In Garage

ld_driveriscaringarage(position)

Returns for the race position if the driver’s car is in the garage (when available).

Get Driver Pit Count

ld_driverpitcount(position)

Returns for the race position how many times the driver went to the pits (when available).

Get Driver Laps Since Last Pit Out

ld_driverlapsdonesincelastpitout(position)

Returns for the race position how many laps the driver drove since the last pit exit, 0.0 to X.0 - guessed (when available).

Get Driver Last Pit Duration

ld_driverpitlastduration(position)

Returns for the race position how long the last pit stop took (when available).

Get Opponent Leaderboard Position Ahead/Behind

ld_getopponentleaderboardposition_aheadbehind(relativePos)

Returns the leaderboard position of the player’s ahead/behind on track opponents (0 = player, -1 = the first ahead, 1 the first behind).

Get Opponent Leaderboard Position Ahead/Behind Class Only

ld_getopponentleaderboardposition_aheadbehind_playerclassonly(relativePos)

Returns the leaderboard position of the player’s ahead/behind on track opponents for the player class (0 = player, -1 = the first ahead, 1 the first behind)

Get Opponent Leaderboard Position Player Class Only

ld_getopponentleaderboardposition_playerclassonly(position)

Returns the leaderboard position of the opponents of the same class as player (1 = first opponent of the class).