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 Dustin O
on
I am currently writing a new theme and was wanting to attempt to get the total time of the leader start to finish to display on the results page. I currently have a converter script that can return the best lap of the leader (for qualifying ticker/grid) and then returns the gap to the leader if they aren't the leader. I was trying to convert this to either show the last lap's number, or preferably the total race time of the leader.

I didn't see any intellisense for a method to return an array of all lap times from a driver, or any value of the total time. I imagine it would be costly to grab all of the laps, but it really only has to happen once, for the overall leader.


using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Results;
using ATVO.ThemesSDK.Data.Lap;

namespace Scripts
{
public class Script : IScript
{
public object Execute(ThemeContentItem item,
object value,
string parameter,
ISimulation sim)
{
IEntitySessionResult result = (IEntitySessionResult) value;
if (result != null)
{
if (result.ClassPosition == 1)
{
var number = (ILap) result.Laps;
var lapnum = number.Number;
string str = lapnum.ToString(); //This returns a strange output, not the lap number.
return ("Lap " + str);
}
else
{
string outputStr = "DNF";
if(result.ClassGap > 0)
{
outputStr = "+" + result.ClassGap.ToString("0.000");
}
return outputStr;
}
}
else
return null;

}
}
}


So, what's the correct parameter to get the lap number from iLap, or the best way to get all laptime values out of the driver result?