Due to increasing spam attacks, forum registrations are currently paused to keep our community safe and spam-free. Come hang out and stay connected with us on the SimHub Discord: https://discord.com/invite/nBBMuX7!

Catch you on Discord — and thanks for understanding!
Need programming he...
 
Notifications
Clear all

Need programming help to finish my dash. Invalid times in Assetto Corsa.

17 Posts
4 Users
0 Reactions
9,292 Views
(@bartun)
Active Member
Joined: 3 years ago
Posts: 12
Topic starter  

Okay, Finally I made a Personal Best Laptime Delta, probably it's not very accurate because this is not the way to calculate the delta, but it seems it make the work.

 

I made a code that reads the My Documents\Assetto Corsa\personalbest.ini file and reads car@track record and grab the TIME=, then transform it to seconds.milliseconds. We calculate delta = EstimatedLapTime - PersonalBestLaptime. We format it to have only 2 decimals, and we add a "+" if it's possitive.

root.BestLap = 0;
root.Car = ucase($prop('CarId'));
root.Track = ucase($prop('TrackCode'));
root.Estimated = timespantoseconds($prop('PersistantTrackerPlugin.EstimatedLapTime'));
root.Delta = 0;

root.Key = "[" + root.Car + "@" + root.Track + "]\r\nDATE=\r\nTIME=";

root.Content = readtextfile('F:\\Documentos\\Assetto Corsa\\personalbest.ini');

root.Regex = new RegExp("\\[" + root.Car + "@" + root.Track + "\\][\\s\\S]*?TIME=(\\d+)", "i");
root.Match = root.Regex.exec(root.Content);

if (root.Match) {
  root.BestLap = parseInt(root.Match[1]);
}

root.Time = root.BestLap.toString();
root.Seconds = root.Time.slice(0, -3);
root.Milliseconds = root.Time.slice(-3);
root.FormattedTime = root.Seconds + "." + root.Milliseconds;
root.Delta = root.Estimated - root.FormattedTime;

root.Delta = root.Delta.toFixed(2);

if (root.Delta > 0) {
  root.Delta = "+" + root.Delta;
}

return root.Delta;

This post was modified 3 years ago by bartun

   
ReplyQuote
(@quintanbarnes)
Active Member
Joined: 2 years ago
Posts: 5
 

Honestly, when it comes to coding projects, I’ve noticed that Python is one of those languages that’s super flexible but can also get messy if you don’t have the right structure from the start. A while ago, I needed help with some backend tasks and didn’t really want to build an in-house team just for that. That’s when I came across NEKLO and their Python outsourcing service. What stood out was how smooth the whole process felt — they didn’t just “throw code” at the problem, but actually made sure the solution fit the bigger picture of the project. It saved me a ton of time, and the collaboration felt easy, almost like working with an internal teammate rather than an external vendor

 

This post was modified 4 weeks ago by quintanbarnes

   
ReplyQuote
Page 2 / 2
Share:
📄 Terms & Conditions | 📑 Privacy Policy