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
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).
Have you also tried joining their discord? Lots of smart people on their channel. Helped me out a couple of times too.
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
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.
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.
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.