Returned Values From Scaleform

How does one get the value returned from a scaleform function like in the “ATM.gfx” theres a function called GET_CURRENT_SELECTION that returns an int, but how do i get this back to my C# script

Many Thanks

Thought I would answer my own question from a few years back.
If anyone finds it helpful

public static class ScaleformHelper
    {
        public static async Task<T> GetReturnValue<T>(int scaleformHandle, string functionName, params object[] args)
        {
            BeginScaleformMovieMethod(scaleformHandle, functionName);
            if (args != null)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i] is int)
                    {
                        PushScaleformMovieFunctionParameterInt((int)args[i]);
                    }
                    else if (args[i] is float)
                    {
                        PushScaleformMovieFunctionParameterFloat((float)args[i]);
                    }
                    else if (args[i] is string)
                    {
                        PushScaleformMovieFunctionParameterString((string)args[i]);
                    }
                    else if (args[i] is bool)
                    {
                        PushScaleformMovieFunctionParameterBool((bool)args[i]);
                    }
                }
            }
            int returnHandle = EndScaleformMovieMethodReturn();
            while (!IsScaleformMovieMethodReturnValueReady(returnHandle))
            {
                await BaseScript.Delay(0);
            }
            if(typeof(T) == typeof(int))
            {
                return (T)(object)GetScaleformMovieFunctionReturnInt(returnHandle);
            }
            else if (typeof(T) == typeof(string))
            {
                return (T)(object)GetScaleformMovieFunctionReturnString(returnHandle);
            }
            else if (typeof(T) == typeof(int))
            {
                return (T)(object)GetScaleformMovieFunctionReturnBool(returnHandle);
            }
            return default(T);
        }
    }

Examples

ATM, WebBrowser
int currentSelection = await ScaleformHelper.GetReturnValue<int>(Scaleform, "GET_CURRENT_SELECTION");
Hacking PC
int cursorClick = await ScaleformHelper.GetReturnValue<int>(Scaleform, "CURSOR_CLICK", 17);