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
This would be the script. If you compare it with the last example I posted before, you can probably see the difference:

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

namespace Scripts
{
public class test : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
// Bind to "entitysessionresult_object" value
// This puts the session result in the value as a type of IEntitySessionResult
// You must tell the compiler that this is the type you are expecting such
// that it knows what properties are available.

// Tell the compiler the value is of type IEntitySessionResult:
IEntitySessionResult result = (IEntitySessionResult) value;

// Check if driver is in first place
if (result.Position == 1)
{
// If so, return the text you want to display for P1
return "LIVE GAP";
}
else
{
// If not, return the live gap property
// The "ToString("0.0")" part controls how many decimals to display. Try "0.00" or "0.000" for example.
return result.LiveGap.ToString("0.0");
}
}
}
}


Same script without the comments, maybe that makes it clearer to read (and it doesn't make our syntax highlighting mess up)
using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Results;

namespace Scripts
{
public class test : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
IEntitySessionResult result = (IEntitySessionResult) value;
if (result.Position == 1)
{
return "LIVE GAP";
}
else
{
return result.LiveGap.ToString("0.0");
}
}
}
}