Middle Script Editor add Ordinal

If the data stream needs an ordinal the fastest fix is to use our middle script editor to transform the incorrect value to what it should be. To work with the middle script launch ScoreBridge™, load a configuration and open the settings.

IN THE SETTINGS PANEL SELECT SCRIPTING MODULE, A SCRIPT EDITOR WILL OPEN UP.

SELECT THE REFERENCE VARIABLE THAT NEEDS THE TRANSFORMATION Down, Qtr, Period (or whatever you have it labeled). THE MIDDLE AREA IS A TEXT EDITOR.
COPY AND PASTE THE BELOW CODE. WHEN DONE CHECK THE ENABLE CHECKBOX SAVE AND COMPILE. CLOSE THE SCRIPT EDITOR, THEN TEST.

namespace UserScript
{
using System;

/* The script module allows you to take the value that would normally be sent to the output *
* and make changes to it before it reaches the output method. *
* This enables users to make simple or complex conditions to better suite needs. *
* *
* It can be used to translate serial values that come in as 1 or 0 boolean and translate *
* it to something readable on different platforms like True or False. *
* *
* Alternatively it could be used to replace images in systems like Tri-caster, using *
* the result of the possession indicator could swap images out using the Datalink feed. */

public class RunScript
{
//USERS SHOULD NOT CHANGE THIS CODE UNDER MOST CIRCUMSTANCES

//`Input` is the value set by ScoreBridge that you will use to condition the output.
private string Input = "";
public void SetRead(string Value)
{
Input = Value; //Should Not Change!
}

//USERS SHOULD MAKE CHANGES HERE

public string Eval()
{
//Sample Logic:
int val = 1;
int.TryParse(Input, out val);
return val.ToNth();
}
}

public static class Extensions
{
public static string ToNth(this int input, int numOfPeriods = int.MaxValue)
{
if (input == numOfPeriods + 1)
return "OT";
if (input > numOfPeriods)
return (input - numOfPeriods) + "OT";
return input + ((input / 10 == 1)
? "TH": (input % 10 == 1)
? "ST": (input % 10 == 2)
? "ND": (input % 10 == 3)
? "RD": "TH");

}
}
}