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
You can easily achieve this with a custom dataset script. These are only available on Beta and Alpha channel at the moment unfortunately but I plan to merge them to stable soon.

Just add a new Script, and in the dialog select the template as "Custom dataset script". The script will get some complicated looking code, but all you need to do is put your own stuff in the "OrderResults" function. That one allows you to sort the results as you want, and after saving and compiling the script you should be able to select it as a dataset.

In your case you'd probably end up with this:
using System;
using System.Linq;
using System.Collections.Generic;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemeEditor.ThemeModels.DataSets;
using ATVO.ThemesSDK.Data.Results;
using ATVO.ThemesSDK.Ordering;

namespace Scripts
{
public class PosGainedDataset : CustomStandingsDataSet
{
protected override IList<IEntitySessionResult> FilterResults(
ISimulation sim,
IList<IEntitySessionResult> results)
{
return results;
}

protected override IList<IEntitySessionResult> OrderResults(
ISimulation sim,
IList<IEntitySessionResult> results,
IDataOrder order)
{
return results.OrderByDescending(r => r.LivePosition - r.StartPosition).ToList();
}

protected override ISessionResult GetSession(ISimulation sim)
{
return sim.Session.Current;
}
}
}


There is no 'positions gained' property, but you can easily calculate it just by taking current (optionally: live) position and subtracting their starting position.