SimHub outlap

Discussion in 'Automobilista 2 - Modding' started by wowbagger, Feb 23, 2025.

  1. wowbagger

    wowbagger Active Member AMS2 Club Member

    Joined:
    Mar 9, 2016
    Messages:
    179
    Likes Received:
    85
    Does anyone have a clever solution for determining in Simhub when the player is on an outlap?

    Cheers
     
  2. Racinglegend1234

    Racinglegend1234 AMS2 wiki founder AMS2 Club Member

    Joined:
    Jul 28, 2022
    Messages:
    6,068
    Likes Received:
    2,100
    maybe if laptime isn't recorded on the outlap you can use that
     
  3. wowbagger

    wowbagger Active Member AMS2 Club Member

    Joined:
    Mar 9, 2016
    Messages:
    179
    Likes Received:
    85
    Unfortunately that doesn't work. :(
     
    • Informative Informative x 1
  4. Ace

    Ace New Member

    Joined:
    Dec 4, 2024
    Messages:
    6
    Likes Received:
    2
    It should work like this in js (not real coding, but you should get the idea):
    - define var lapInPit = 0 in the area that is only run once
    - For the regular updates:
    if car is in pit and lapInPit !== currentLap, set the value lapInPit to currentLap
    if lapInPit - 1 == currentLap, you are on the outlap and can do whatever you want to do with it
     
  5. wowbagger

    wowbagger Active Member AMS2 Club Member

    Joined:
    Mar 9, 2016
    Messages:
    179
    Likes Received:
    85

    The problem is that AMS2 reports currentLap = 1 for the outlap, and the same (currentLap = 1) for the subsequent flying lap. Nothing changes as you transition from the flying lap to the outlap.

    Similarly, when you are on your first flying lap, completedlaps = 0 .

    I'm trying to find a property that will register when the outlap had ended and the flying lap has begun.

    The rF2 plugin has an isonoutlap property which works great - but only for rF2 (maybe LMU too, I haven't tested it).
     
  6. Marius H

    Marius H Forum moderator Staff Member AMS2 Club Member

    Joined:
    Mar 24, 2016
    Messages:
    6,216
    Likes Received:
    2,886
    Have you also tried joining their discord? Lots of smart people on their channel. Helped me out a couple of times too.
     
  7. Ace

    Ace New Member

    Joined:
    Dec 4, 2024
    Messages:
    6
    Likes Received:
    2
    You're right, if you start in the pit my solution won't work, only if you want to capture if mid-race someone is on an outlap.

    I think the first flying lap still sets your lastlap value for the outlap. If it does you could build a workaround for the very first outlap that once lastlap is set the outlap trigger is false. Otherwise I would have to check which values will change form outlap to first flying lap
     
    Last edited: Feb 24, 2025
  8. wowbagger

    wowbagger Active Member AMS2 Club Member

    Joined:
    Mar 9, 2016
    Messages:
    179
    Likes Received:
    85
    I've actually previously posted some questions on their discord a few times and never ever had a reply of any kind, so I've kind of given up on that avenue.

    Sadly, the lastlaptime value remains 0 for your outlap and during your first flying lap. It only changes once you complete a flying lap.

    I've been looking for any value that differentiates an outlap and so far have come up short.
     
    • Like Like x 1
  9. wowbagger

    wowbagger Active Member AMS2 Club Member

    Joined:
    Mar 9, 2016
    Messages:
    179
    Likes Received:
    85
    I think this might work:

    The GentlemanDriverPlugin has a property Laps.StintTotal which seems to work with AMS2.
    - outlap Laps.StintTotal = 0
    - flying lap Laps.StintTotal = 1
    - resets properly to zero when you pit

    Will try to make this work for my purposes.

    In any event, thanks to everyone for all the replies and suggestions.
     
    • Like Like x 1
  10. wowbagger

    wowbagger Active Member AMS2 Club Member

    Joined:
    Mar 9, 2016
    Messages:
    179
    Likes Received:
    85
    Just to update this ... the Laps.StintTotal property doesn't reliably work with AMS2 either.

    I've resorted to using the StintOdo property and comparing it to the track.length to get a close enough estimate of what lap of the stint I am on.
     
    • Like Like x 1
  11. Full Pace

    Full Pace Full Pace Simracing AMS2 Club Member

    Joined:
    Jul 18, 2022
    Messages:
    49
    Likes Received:
    10
    I use timespantoseconds([CurrentLapTime])==0
     
    • Like Like x 1
    • Informative Informative x 1

Share This Page