/// <summary> /// Adds a named script to the library /// </summary> /// <param name="name">The script's name</param> /// <param name="str">The script to add</param> /// <returns>Returns true if the script was successfully added, false otherwise. This method returns false if there's already a script with the specified name in the library</returns> public bool AddNamedScript(string name, ref GTXScriptData script) { if (namedScripts.ContainsKey(name)) { return(false); } else { namedScripts.Add(name, script); return(true); } }
/// <summary> /// Adds a script to the library /// </summary> /// <param name="id">The script's id</param> /// <param name="str">The script to add</param> /// <returns>Returns true if the script was successfully added, false otherwise. This method returns false if there's already a script with the specified id in the library</returns> public bool AddScript(uint id, ref GTXScriptData script) { if (scripts.ContainsKey(id)) { return(false); } else { scripts.Add(id, script); return(true); } }
public uint StartNamedScript(string name, byte [] args) { if (!namedScripts.ContainsKey(name)) { throw new ArgumentException("The specified script name does not exist"); } GTXScriptData scData = namedScripts [name]; GTXScript script = new GTXScript(this, scData.MemorySize, scData.StackSize); Support.Stack <byte> stk = new Support.Stack <byte> (scData.StackSize); script.Stack = stk; uint pID = (uint)script.GetHashCode(); script.PID = pID; runningScripts.Add(pID, script); return(pID); }