JavaScript N00b! Eq...
 
Notifications
Clear all

JavaScript N00b! Equating time to finish stage?

3 Posts
2 Users
2 Likes
1,434 Views
(@palendrone)
Active Member
Joined: 3 years ago
Posts: 5
Topic starter  

So I'm not a coder but having tried to fathom out this I'm lost... I figured by taking the Estimated Stage Time and subtracting the current stage time I could have 'time until stage complete' time. (Why I hear you ask? so that I can have an iPad displaying this outside my spare room door to not be disrupted by my wife and children mid rally stage in Dirt Rally 2.0!)

 

vi was hoping the following would work: BUT SADLY NOT

 

Estimate = ($prop('PersistantTrackerPlugin.EstimatedLapTime') - $prop('DataCorePlugin.GameData.NewData.CurrentLapTime'));

return vEstimate

 

What does it need to be to do what I require?

 

Thanks for your help.

This topic was modified 3 years ago by Palendrone

   
Quote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

Hi,

you have to convert the timespans to seconds before doing math with them. And back again if needed.
Try this:

Estimate = secondstotimespan(timespantoseconds($prop('PersistantTrackerPlugin.EstimatedLapTime')) - timespantoseconds($prop('DataCorePlugin.GameData.NewData.CurrentLapTime')));

return Estimate;


   
Palendrone reacted
ReplyQuote
(@palendrone)
Active Member
Joined: 3 years ago
Posts: 5
Topic starter  

Thank you for the great answer Romainrob. Just tried this and it works perfectly :0) 


   
Romainrob reacted
ReplyQuote
Share: