Replies: 1 comment 1 reply
-
The idea is correct (also indexes) but the gap returned by
So your code is only correct if any of the Relative leaderboards is selected. However if (for example) Overall leaderboard is selected it would show the gaps to the leader, not to you. I believe what you actually want is So a working code is following var idx = $prop('DynLeaderboardsPlugin.Dynamic.FocusedPosInCurrentLeaderboard')
var ahead = $prop('DynLeaderboardsPlugin.Dynamic.' + idx + '.Gap.ToFocused.Total')
if (ahead == null) {
return ''
}
if (ahead > 10000) {
return format(ahead - 100000, '0', true) + 'L'
}
return format(ahead, '0.00', true) var idx = $prop('DynLeaderboardsPlugin.Dynamic.FocusedPosInCurrentLeaderboard') + 2
var behind = $prop('DynLeaderboardsPlugin.Dynamic.' + idx + '.Gap.ToFocused.Total')
// same formatting code Note that the gap to ahead is always positive and gap to behind is negative. If you want other signs you can easily correct it. This version also allows to change which cars are the ahead and behind car. For example if you have selected Overall/RelativeOverall/PartialRelativeOverall leaderboard then the cars ahead and behind are in overall order. If Class/... leaderboard then the cars ahead and behind are the ones in class and so on. If you only want the gap to the car ahead/behind in overall order then there is also var idx = $prop('DynLeaderboardsPlugin.Dynamic.FocusedPosInCurrentLeaderboard') + 1
var ahead = $prop('DynLeaderboardsPlugin.Dynamic.' + idx + '.Gap.ToAhead.Overall')
// same formatting code var idx = $prop('DynLeaderboardsPlugin.Dynamic.FocusedPosInCurrentLeaderboard') + 2
var behind = $prop('DynLeaderboardsPlugin.Dynamic.' + idx + '.Gap.ToAhead.Overall')
// same formatting code |
Beta Was this translation helpful? Give feedback.
-
I want to do a gap screen for ahead and behind my car based on dynLeaderboard data.
Now I use the following code, this is correct?
This is ahead, behind is idx+2.
`
var idx = $prop('DynLeaderboardsPlugin.Dynamic.FocusedPosInCurrentLeaderboard')
idx = idx ;
var v = $prop('DynLeaderboardsPlugin.Dynamic.' + idx + '.Gap.Dynamic.ToFocused')
if (v == null) {
return ''
}
if (v > 10000) {
return format(v - 100000, '0', true) + 'L'
}
return format(v, '0.00', true)`
Concept show in attached picture
Beta Was this translation helpful? Give feedback.
All reactions