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.
using System;
using ATVO.ThemesSDK;
using ATVO.ThemesSDK.Data.Entity;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Controls;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Enums;
using ATVO.ThemesSDK.Data.Results;
using ATVO.ThemeEditor.Scripting;
using System.Text;
namespace Scripts
{
public class Script
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
// Bind to "entitysessionresult_obj" to get the IEntitySessionResult as the value
// Cast to IEntitySessionResult type
IEntitySessionResult result = (IEntitySessionResult) value;
// We need the following information to determine whether to show gap or laps
var pos = result.LivePosition;
var gap = result.LiveGap;
var type = result.Session.Type;
// Check the session type is RACE
if (type == SessionType.Race)
{
// Check DNS, Out, Pits, etc
if (result == null)
return "";
if (result.DidNotStart)
return "DNS";
if (result.Out)
return "OUT";
// If the car is in the same lap just return the time
return "+" + gap.ToString("0.000");
}
// If the session type not RACE return LEADER for P1 and time for the rest
if (result == null)
return "no time";
// I get error here (the name Result does not exist in the current context)
if (pos == 1)
return Result.SessionTime; // total race duration formatted // I get error here (the name Reslt does not exist in the current context)
else
return "+" + gap.ToString("0.000");
}
}
}