Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
There are a number of problems with the script.

First the most obvious: you typed 'Result' but the variable is called 'result'. C# scripts are case sensitive.

Next, the code you have added won't be reached in a race. It would already have returned the gap a few lines above. You need to move that new code to somewhere under the "if type == Race" part.

Next, I don't think SessionTime is a valid property of an IEntitySessionResult. You say the Github mentions it, but it's on another type: ISessionResult. Long story short: IEntitySessionResult is the result for a driver/car/team, while ISessionResult is the session data itself. You can get to the current session result from "sim.Session.Current", so you could use sim.Session.Current.SessionTime".

Finally, I don't think SessionTime is going to give you what you want. Probably you want the total time the leader needed to finish? SessionTime is just the number of seconds elapsed since the session started and I think it will keep going up after the finish. It also starts before the race. I think you'd need to use some way to store the finish time and subtract SessionStartTime. I will see if we can offer you something to use in the data rather than doing it yourself.


I also don't know what you mean with "connect sdk with microsoft code". Do you mean Visual Studio Code (VS Code)? That is just a convenient application that you can write your scripts in. You can write the same scripts in ATVO or in VS Code, but the VS Code script editor is much more powerful.