Color display for s...
 
Notifications
Clear all

[Solved] Color display for sector times from Lovely Dashboard

1 Posts
1 Users
0 Reactions
255 Views
(@ehsanmomeni)
Eminent Member
Joined: 2 years ago
Posts: 9
Topic starter  

**UPDATE**

So here is a update that nobody ask for, but I think I solved the problem, but if anyone with more coding skill would like to take a look at it and debug you are more than welcome.

Now it should show the sector difference between you and the driver ahead/behind for each sector on the current lap, and a sector summary after the lap. If I'm faster thru a sector is displays as green under my opponents name and red if I'm slower.

This is inspired by and made possible from the sector color bars from Lovely Dashboard.

The code for the SectorDeltaReview > BackgroundColor:

function LastSectorColor(sector) {
var mySector = timespantoseconds(driversectorlastlap((getplayerleaderboardposition()), sector, false));
var behindSector = timespantoseconds(driversectorlastlap((getplayerleaderboardposition()+1), sector, false));
var diff = (mySector-behindSector);

if (diff > 0) {
    return 'Tomato';
    } else {
    return 'SpringGreen';
    }
}    
return LastSectorColor( repeatindex() )

The code for the SectorDelta > BackgroundColor:

function driverSectorSegmentColor(driver, sector) {
    
var timeDiff = timespantoseconds( driversectorcurrentlap( driverPos, sector, false) ) - 
                    timespantoseconds( driversectorcurrentlap( driverBehind, sector, false) );
                    
if (sector >= drivercurrentsector( driver ) ) {
    return '#FF444444';
    } else if (timeDiff > 0) {
        return 'Tomato';
    } else if (timeDiff < 0) {
        return 'SpringGreen';
    } else {
        return 'FFFF6347';
    }

}

var driverPos = getplayerleaderboardposition();
var driverBehind = (getplayerleaderboardposition()+1);
return driverSectorSegmentColor( driverPos, repeatindex() )

_________________________________________________________

I don't know if this is the right place, if not, I'm sorry.

Since I switched to VR, I no longer use the Lovely Dashboard, but I do stream and I have created a overlay that uses one part of the Lovely Dashboard that I really enjoyed, and it's the colored sector bars (see picture). But I would like to have it show the sector difference between my sector times and the driver ahead/behind. I have tinkered a lot with the code, but I lack the coding skills to make it work 100%. I can make it work for all the sector on the current lap, except the last sector, and the sector review doesn't work at all, see below.

What I would like is to have the sector color bars on my overlay under the driver behind/ahead (second image, bottom left and bottom right) so that if I'm faster thru sector 1 compared to the driver behind it will turn green, and then the diff in sector 2 and so on, if it makes any sense.

Since I race in VR i don't see it anyways but it would be a cool overlay, just like the F1 broadcast.
Thanks

This is the code so far that I've added in the BackgroundColor for the SectorDelta (rectangle)

 
 
This topic was modified 2 months ago 6 times by ehsanmomeni

   
Quote
Share: