Javascript Help wit...
 
Notifications
Clear all

Javascript Help with Pitroad speed code

2 Posts
1 Users
0 Reactions
2,214 Views
JoshuaBrown
(@joshuabrown)
New Member
Joined: 4 years ago
Posts: 3
Topic starter  

Hey guys, thanks for having a look. 
I'm trying to write a code that will display the speed difference between the car speed, and pit road speed. 
I have gotten to the point that it always gives me the same error, 
Admittedly, Im not as schooled on Java as I would like to be, I'm not trying to make it a profession, I just want this code to work.
Any help would be greatly appreciated. 

Here's the code I have:

var speed = $prop('SpeedKmh');
var pit = $prop('GameRawData.SessionData.WeekendInfo.TrackPitSpeedLimit');
         
         var difference = function (pit, speed){
             Math.abs(pit-speed);
         }
         return  (difference)
         

output: System.Func`3[Jint.Native.JsValue,Jint.Native.JsValue[],Jint.Native.JsValue]

60fps club

This topic was modified 4 years ago by JoshuaBrown

   
Quote
JoshuaBrown
(@joshuabrown)
New Member
Joined: 4 years ago
Posts: 3
Topic starter  

I figured it out, the "kph" on the end of pit road speed was screwing everything us, I parsed it. 
Its working properly now.

var speed = $prop('SpeedKmh');
var pit = parseInt($prop('GameRawData.SessionData.WeekendInfo.TrackPitSpeedLimit'));

         
         
         if(speed<pit) {
         return (pit-speed);
         } else if(speed=pit) { 
           return (pit);
         } else if(speed>pit) {
         return (speed-pit)
         }
    


   
ReplyQuote
Share: