Closed sdhengsoft closed 1 month ago
Hi ! All those properties have been deprecated in favour of a set of functions giving access to all the existing data no matter if it's in a "ahead behind" format or the more conventional leaderboard format : https://github.com/SHWotever/SimHub/releases/tag/9.1.0
To avoid breaking existing creations the properties are still working but are not listed anymore I'm favour of the more feature rich functions set.
Ahh, perfect. Thanks for that.
I tried the new function methods, but I'm having trouble getting driver gap information. I'm just trying to get the time gap of the car directly ahead and behind my position on track. I tried this:
var driverPos = getopponentleaderboardposition_aheadbehind( -1); var tGap = drivergaptoplayer( driverPos);
This works great during a "Race" session type. However, no data is returned for "Practice" or "Qualifying" session types.
Whereas:
var tGap = $prop( 'PersistantTrackerPlugin.DriverAhead_00_Gap');
returns valid data in all session types.
Any thoughts? I also tried the function driverrelativegaptoplayer( driverPos)
. Not sure what the intended difference is between these two calls (they are different values), but both only have data during a race. The 1st function matches the gaps reported in R3E leaderboard exactly.
Hello ! Apparently you were close :
driverrelativegaptoplayer(getopponentleaderboardposition_aheadbehind(-1))
should give the same result as before, the only difference is that the lack of data is clearly available now returning null instead of 0 when nobody is in front (front being up to 50% of the lap in front)
Okay, I thought I tried this one. I'll give is another try and get back with a comment. Thanks.
Ha! Thanks for that. I can see the subtle error now. This is the code I had:
var driverPos = getopponentleaderboardposition_aheadbehind( -1);
var tGap = drivergaptoplayer( driverPos);
if ( tGap == null) {
tGap = driverrelativegaptoplayer( driverPos);
}
return tGap;
Just had to change the tGap == null
to tGap == 0
. I was expecting the null
return. Whoops!
Also, it looks like I may not need the IF
section at all and just use:
return driverrelativegaptoplayer( getopponentleaderboardposition_aheadbehind( -1));
But I'll check the time gap matches the R3E values when I race next.
Thanks again.
SimHub Version 9.2.12
Variables like:
PersistantTrackerPlugin.DriverAhead_00_Gap PersistantTrackerPlugin.DriverAhead_00_Name PersistantTrackerPlugin.DriverBehind_00_Gap PersistantTrackerPlugin.DriverBehind_00_Name
Seem to be missing from the property list when trying to search for them. They do seem to work inside the code with no trouble. You just can't see them in the property list when searching for them.