Aces AMS2 Multiclass Simhub Overlay

Discussion in 'Automobilista 2 - Modding' started by Ace, Apr 4, 2025.

  1. Mellowaid

    Mellowaid New Member

    Joined:
    Jun 4, 2024
    Messages:
    5
    Likes Received:
    1
    Hello,

    would it be possible to have Best lap in the leaderboard for every driver instead of last lap as that is also in the releative. would be nice to see who has the fastest pace possible durring a run. Also if your running fastest lap points its a quick refrence point.

    Other then that i am really enjoying this overlay.
     
  2. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    43
    Likes Received:
    41
    I wouldn't change for the whole dashboard, but I can easily show you how you can change that for yourself at the moment.

    Go to the overlays in Simhub and rightlick on the class leaderboard -> Edit Dashboard
    On the right side open ClassLeaderboard/ClassLeaderboard/TextLastLap.
    Edit the field "Text" by the green button, replace all coding to
    Code:
    return 'BEST LAP';
    Scroll down on the top right an open ClassLeaderboard/ClassLeaderboard/TopCars/TopCarss/Car/Car_LastLap. Again click on the green button at "Text":
    Replace all coding by this:
    Code:
    var indexMod = - 2;
    
    var playerPos = driverclassposition($prop("Position"));
    var classSize = $prop('PlayerClassOpponentsCount');
    if(classSize == playerPos) { indexMod -= 2 };
    if(classSize - 1 == playerPos) { indexMod -= 1 };
    
    carIndex = repeatindex();
    if(driverclassposition($prop('Position')) > 7 && repeatindex() >= 5) {
        carIndex = driverclassposition($prop('Position')) + indexMod + repeatindex() - 5;
    }
    
    var counter = 1;
    for(var i = 1; i <= $prop('OpponentsCount'); i++) {
        if($prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.CarClass') == $prop('CarClass')) {
            if(counter == carIndex) {
                var thisPos = $prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.Position');
                break;
            }
            counter++;
        }
    }
    thisLap = driverbestlap(thisPos)
    if(thisLap == '00:00:00') {
        return '';
    } else {
        var timeString = thisLap.toString();
        var parts = timeString.split(':');
        var minutes = parseInt(parts[1], 10);
        var secParts = parts[2].split('.');
        var seconds = parseInt(secParts[0], 10);
        var millis = (secParts[1] || '0').padEnd(3, '0').substring(0, 3); // genau 3 Stellen
        var formattedTime = (minutes > 0 ? minutes + ':' : '0:') +
                            seconds.toString().padStart(minutes > 0 ? 2 : 1, '0') + '.' + millis;
       
        return formattedTime;
    };
    Go to Object ClassLeaderboard/ClassLeaderboard/TopCars/TopCarss/Car/Car_LastLapColor right under it and click on the green button of "BackgroundColor", change coding to:
    Code:
    var indexMod = - 2;
    
    var playerPos = driverclassposition($prop("Position"));
    var classSize = $prop('PlayerClassOpponentsCount');
    if(classSize == playerPos) { indexMod -= 2 };
    if(classSize - 1 == playerPos) { indexMod -= 1 };
    
    carIndex = repeatindex();
    if(driverclassposition($prop('Position')) > 7 && repeatindex() >= 5) {
        carIndex = driverclassposition($prop('Position')) + indexMod + repeatindex() - 5;
    }
    var counter = 1;
    for(var i = 1; i <= $prop('OpponentsCount'); i++) {
        if($prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.CarClass') == $prop("CarClass")) {
            if(counter == carIndex) {
                var thisPos = $prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.Position');
                break;
            }
            counter++;
        }
    }
    thisLap = driverbestlap(thisPos)
    if(thisLap == '00:00:00') {
        return 'Transparent';
    }
    
    var bestLapOp = 999;
    for(var i = 1; i <= $prop('OpponentsCount'); i++) {
        if($prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.CarClass') == $prop("CarClass")) {
            bestThisLap = $prop('GarySwallowDataPlugin.Leaderboard.Position'+(i < 10 ? "0" : "") + i +'.BestLap').toFixed(3);
            if(bestThisLap < bestLapOp && bestThisLap > 0) {
                bestLapOp = bestThisLap;
            }
        }
    }
    
    var lapTimeString = thisLap.toString().replace(',', '.');
    var parts = lapTimeString.split(':');
    var hours = parseInt(parts[0]);
    var minutes = parseInt(parts[1]);
    var seconds = parseFloat(parts[2]);
    var thisLap = hours * 3600 + minutes * 60 + seconds;
    if(thisLap == bestLapOp && bestLapOp > '0') {
        return '#B0921DFF';
    }
    
    return 'Transparent';
    Now the leaderboard should always show you the best Laps instead of Last Laps in races. But have in mind when the fastest lap in the not the 9 visible places on the leaderboard you will not see it.

    Maybe an optional window for the fastest lap of your class is a good idea for the future, what do you think?
     
  3. maitevel

    maitevel Member

    Joined:
    Dec 18, 2023
    Messages:
    31
    Likes Received:
    10
    Hi!
    Is there progress with penalties? That's what I've been waiting for since you announced your overlays. I know it's not easy. In any case, thank you for your overlays.
     
  4. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    43
    Likes Received:
    41
    I have a running testversion of it. I nailed down most of the logic (bascially if you have to measure how long a car needs for a lap and compare it to the last lap time after he crosses the finishline, the officiall last lap result will have penalties added), but it sadly still has some bugs so it counts penalties that are not there. It seems like things like pausing to the menu cause the issues, especially in multiplayer races it goes quite off.

    So I'm still working on getting it running correctly, currently a bit busy with other stuff, but I hope I can add it for v1.2
     
    • Like Like x 1
  5. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    43
    Likes Received:
    41
    A new version is here. It should hotfix issues like special letters still appearing broken and as they are ready I included two new overlays

    Input Circle
    [​IMG]
    Very simple display of Throttle and Brake input. It makes learning trailbraking and gentle throttle application way easier

    Air & Track Temperature Monitor
    [​IMG]
    As requested by users you can now display the Air and Track temperatures. Sadly there is no way to display weather informations or the current time of day of the session in simhub.

    I recommend updating to current Simhub version 9.8.4 for this update.

    What's next?
    As a tiny look into 1.2, I'm working on a MFD overlay that includes most of the functions (relatives, tires, electronics, etc), so you can see all important informations by cycling through the MFD instead of having everything shown at once. This will come with a fitting smaller telemetry monitor that doesn't rely on showing everything all the time. Of course these are additional overlays and not replacing existing overlays

    Getting time penalties finally working is still in progress too.

    The full patchnotes.
    v1.1.2
    New Overlay: Input Circle
    • Simple display of your throttle and brake input which works for every supported Simhub game
    New Track & Air Temperature Monitor
    • Simple display of Track and Air Temperature
    Fixes
    • Fixed: Special letters in names are still displayed broken
    • Fixed: Session timers above 1 hour are falsely formatted
    • Fixed: Input Monitor is updating too fast for Simhub Pro Users, making it hard to see your input graph through corners
    • Added Dodge and Jaguar Carmaker Icons for GT World Challenge mod
    • Removed JavaScript Legacy functions where they aren't necessary

    RELEASES
     
    Last edited: Jun 26, 2025 at 7:50 AM
    • Like Like x 5
    • Friendly Friendly x 1
  6. Ace

    Ace Member

    Joined:
    Dec 4, 2024
    Messages:
    43
    Likes Received:
    41
    This version is just a hotfix for displaying special letters in name. I change the routine how names are determined, so now this bug should finally be fixed.

    The hotflix only affects Class Leaderboard, Multiclass Leaderboard and Releatives, so you only have to update those if you already have 1.1.2 installed

    PATCHNOTES:
    • Fixed: Special letters in names are still displayed broken
    RELEASES
    Big thanks to User Molda222 at overtake helping to test this issue
     
    • Friendly Friendly x 1
  7. Mellowaid

    Mellowaid New Member

    Joined:
    Jun 4, 2024
    Messages:
    5
    Likes Received:
    1
    I need to get these updates! looks great thank you for your work!
     
    • Like Like x 1
  8. Mellowaid

    Mellowaid New Member

    Joined:
    Jun 4, 2024
    Messages:
    5
    Likes Received:
    1
    I must have a setting wrong or something, why is my lap count in the class leaderboard always short by 1?
     

Share This Page