How to calculate ti...
 
Notifications
Clear all

How to calculate time difference in NCalc?

6 Posts
3 Users
0 Reactions
4,704 Views
(@azurewing)
New Member
Joined: 4 years ago
Posts: 3
Topic starter  

I am trying to show the delta between my last lap and the last lap of the driver behind & ahead

so i know how much am i (or they are gaining)

[LastLapTime]-[PersistantTrackerPlugin.DriverBehind_00_LastLapTime] doesn't work

i guess calculating time isnt that simple?

may someone please give me a hand?


   
Quote
Topic Tags
(@admin5435)
Prominent Member Admin
Joined: 7 years ago
Posts: 736
 

You need to use seconds to differences (ncalc can't do it on times), you can use timespantoseconds(xxxx) to convert in seconds both operands, 

 

timespantoseconds([LastLapTime])-timespantoseconds([PersistantTrackerPlugin.DriverBehind_00_LastLapTime])


The result will be given in seconds.


   
ReplyQuote
(@azurewing)
New Member
Joined: 4 years ago
Posts: 3
Topic starter  

@admin5435

 

thx for the help

i got some output 

but its not what i want

 

i guess its about the game that i play (F1 2020 - PS4)

becos

when i use

PersistantTrackerPlugin.DriverBehind_00_LastLapTime 
or
PersistantTrackerPlugin.DriverAhead_00_LastLapTime or even 01 02
these one their own is showing my previous lap time
not the car behind or ahead

i guess its the telemetry of the game publishing isnt right

   
ReplyQuote
(@demonicsquid)
New Member
Joined: 4 years ago
Posts: 3
 

@azurewing

Are you sure you are asking for the right data?

You will more than likely only get an update each lap if you query the lap times. Try querying the appropriate deltas in the persistent tracker.

Also look at using the 'driver' functions instead of properties.

This post was modified 4 years ago 2 times by DemonicSquid

   
ReplyQuote
(@demonicsquid)
New Member
Joined: 4 years ago
Posts: 3
 

This works in F1 2020 to get live gaps:

drivergaptoplayer([Position] + 1

drivergaptoplayer([Position]1

drivergaptoleader([Position])

And this gets you lap gaps (replace the final 1 with the same thing as above). Simhub will throw up an error initially when you enter the formula but will correct itself once you've done a lap.

timespantoseconds(driverlastlap(Position)) - timespantoseconds(driverlastlap(1)) 
This post was modified 4 years ago 3 times by DemonicSquid

   
ReplyQuote
(@azurewing)
New Member
Joined: 4 years ago
Posts: 3
Topic starter  

I think i know where went wrong on me

i was using  lap time from quick texts

and input formula from there

which doesn't override the original content

 

i have to use a text and input formula to it

which then give correct information of what i want


   
ReplyQuote
Share: