public void CreateAnimationProcessB(ScriptThread thread) { EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode; if (entity == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CreateAnimationProcess with an invalid object.", LogAlertLevel.Error); return; } thread.SetReturnValue(new ProcessScriptObject(new AnimationProcess(entity, (AnimationMode)thread.GetIntegerParameter(1), thread.GetIntegerParameter(2), thread.GetIntegerParameter(3), thread.GetIntegerParameter(4)))); }
public void CommandLineValue(ScriptThread thread) { string commandLine = thread.GetStringParameter(0); int valueIndex = thread.GetIntegerParameter(1); foreach (string arg in Engine.GlobalInstance.CommandLineArguments) { string[] value = new string[0]; string command = arg; int colonIndex = arg.IndexOf(':'); // Seperate values and command if a colon exists. if (colonIndex >= 0) { value = new string[1]; value[0] = arg.Substring(colonIndex + 1, arg.Length - colonIndex - 1); if (value[0].IndexOf(",") >= 0) value = value[0].Split(new char[1] { ',' }); command = arg.Substring(0, colonIndex); } if (command.ToLower() == commandLine.ToLower()) { if (valueIndex < 0 || valueIndex >= value.Length) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CommandLineValue with an invalid value index.", LogAlertLevel.Error); return; } thread.SetReturnValue(value[valueIndex]); return; } } DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CommandLineValue with a non-existant command line.", LogAlertLevel.Error); }
public void SeekStream(ScriptThread thread) { ScriptStream stream = ((NativeObject)thread.GetObjectParameter(0)).Object as ScriptStream; if (stream == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SeekStream with an invalid object.", LogAlertLevel.Error); return; } stream.Stream.Position = thread.GetIntegerParameter(1); }
public void PauseThread(ScriptThread thread) { ScriptThread actionThread = ((NativeObject)thread.GetObjectParameter(0)).Object as ScriptThread; if (actionThread == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called PauseThread with an invalid object.", LogAlertLevel.Error); return; } actionThread.Pause(thread.GetIntegerParameter(0)); }
public void OpenStream(ScriptThread thread) { Stream stream = StreamFactory.RequestStream(thread.GetStringParameter(0), (StreamMode)thread.GetIntegerParameter(1)); if (stream == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called OpenStream with an unreachable url.", LogAlertLevel.Error); return; } thread.SetReturnValue(new StreamScriptObject(new ScriptStream(stream))); }
public void GameFlagValueAtIndex(ScriptThread thread) { int index = thread.GetIntegerParameter(0); int currentIndex = 0; foreach (string value in Fusion.GlobalInstance.GameFlags.Values) { if (index == currentIndex) { thread.SetReturnValue(value); return; } currentIndex++; } }
public void PadLeftA(ScriptThread thread) { thread.SetReturnValue(thread.GetStringParameter(0).PadLeft(thread.GetIntegerParameter(1))); }
public void Insert(ScriptThread thread) { thread.SetReturnValue(thread.GetStringParameter(0).Insert(thread.GetIntegerParameter(2), thread.GetStringParameter(1))); }
public void LastIndexOfB(ScriptThread thread) { thread.SetReturnValue(thread.GetStringParameter(0).LastIndexOf(thread.GetStringParameter(1), thread.GetIntegerParameter(2))); }
public void RandomB(ScriptThread thread) { thread.SetReturnValue(MathMethods.Random(thread.GetIntegerParameter(0), thread.GetIntegerParameter(1))); }
public void SeedRandom(ScriptThread thread) { MathMethods.SeedRandom(thread.GetIntegerParameter(0)); }
public void EntityHitTestB(ScriptThread thread) { EntityNode entitya = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode; if (entitya == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called EntityHitTest with an invalid object.", LogAlertLevel.Error); return; } CollisionRectangle rect = new CollisionRectangle(new Transformation(thread.GetIntegerParameter(1), thread.GetIntegerParameter(2), 0, 0, 0, 0, 1, 1, 1), thread.GetIntegerParameter(3), thread.GetIntegerParameter(4)); rect.Layers = entitya.CollisionPolygon.Layers; thread.SetReturnValue(entitya.CollisionPolygon.HitTest(rect)); }
public void ConnectToServer(ScriptThread thread) { Networking.NetworkManager.ServerIP = thread.GetStringParameter(0); if (thread.GetIntegerParameter(1) != -1) Networking.NetworkManager.Port = thread.GetIntegerParameter(1); thread.SetReturnValue(Networking.NetworkManager.Start()); }
public void CreateAnimationProcessD(ScriptThread thread) { EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode; int memoryIndex = thread.GetArrayParameter(3); if (entity == null || memoryIndex == 0) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CreateAnimationProcess with an invalid object.", LogAlertLevel.Error); return; } int arrayLength = thread.GetArrayLength(memoryIndex); int[] frames = new int[arrayLength]; for (int i = 0; i < arrayLength; i++) frames[i] = thread.GetIntArrayElement(memoryIndex, i); thread.SetReturnValue(new ProcessScriptObject(new AnimationProcess(entity, (AnimationMode)thread.GetIntegerParameter(1), thread.GetIntegerParameter(2), frames))); }
public void BindKey(ScriptThread thread) { InputManager.BindKey(thread.GetStringParameter(0),(KeyCodes)thread.GetIntegerParameter(1)); }
public void SetCameraClearColor(ScriptThread thread) { CameraNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as CameraNode; if (entity == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SetCameraClearColor with an invalid object.", LogAlertLevel.Error); return; } entity.ClearColor = thread.GetIntegerParameter(1); }
public void WordWrap(ScriptThread thread) { thread.SetReturnValue(StringMethods.WordWrap(thread.GetStringParameter(0), thread.GetIntegerParameter(1))); }
public void SetEntityCollisionBox(ScriptThread thread) { EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode; if (entity == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SetEntityCollisionBox with an invalid object.", LogAlertLevel.Error); return; } entity.CollisionRectangle = new System.Drawing.Rectangle(thread.GetIntegerParameter(1), thread.GetIntegerParameter(2), thread.GetIntegerParameter(3), thread.GetIntegerParameter(4)); }
public void SetChannelFrequency(ScriptThread thread) { ISampleBuffer sound = ((NativeObject)thread.GetObjectParameter(0)).Object as ISampleBuffer; if (sound == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SetChannelFrequency with an invalid object.", LogAlertLevel.Error); return; } sound.Frequency = thread.GetIntegerParameter(1); }
public void LoadSound(ScriptThread thread) { thread.SetReturnValue(new SoundScriptObject(AudioManager.LoadSound(thread.GetStringParameter(0), (SoundFlags)thread.GetIntegerParameter(1)))); }
public void PadRightB(ScriptThread thread) { thread.SetReturnValue(thread.GetStringParameter(0).PadRight(thread.GetIntegerParameter(1), thread.GetStringParameter(2)[0])); }
public void MakeProcessWait(ScriptThread thread) { Runtime.Processes.Process process = ((NativeObject)thread.GetObjectParameter(0)).Object as Runtime.Processes.Process; Runtime.Processes.Process waitForProcess = ((NativeObject)thread.GetObjectParameter(1)).Object as Runtime.Processes.Process; if (process == null || waitForProcess == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called MakeProcessWait with an invalid object.", LogAlertLevel.Error); return; } process.WaitForProcess(waitForProcess, (ProcessResult)thread.GetIntegerParameter(2)); }
public void SubstringB(ScriptThread thread) { thread.SetReturnValue(thread.GetStringParameter(0).Substring(thread.GetIntegerParameter(1), thread.GetIntegerParameter(2))); }
public void SetEntityRenderMode(ScriptThread thread) { EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode; if (entity == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SetEntityRenderMode with an invalid object.", LogAlertLevel.Error); return; } entity.RenderMode = (EntityRenderMode)thread.GetIntegerParameter(1); }
public void Chr(ScriptThread thread) { thread.SetReturnValue(Convert.ToString((char)thread.GetIntegerParameter(0))); }
public void DebugLogA(ScriptThread thread) { DebugLogger.WriteLog(thread.GetStringParameter(0), (LogAlertLevel)thread.GetIntegerParameter(1)); }
public void Sleep(ScriptThread thread) { thread.Pause(thread.GetIntegerParameter(0)); }
public void SetPacketID(ScriptThread thread) { NetworkPacket packet = ((NativeObject)thread.GetObjectParameter(0)).Object as NetworkPacket; if (packet == null) { DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SetPacketID with an invalid object.", LogAlertLevel.Error); return; } packet.ID = thread.GetIntegerParameter(0); }
public void KeyReleased(ScriptThread thread) { thread.SetReturnValue(InputManager.KeyReleased((KeyCodes)thread.GetIntegerParameter(0))); }
public void CreateDelayProcess(ScriptThread thread) { thread.SetReturnValue(new ProcessScriptObject(new DelayProcess(thread.GetIntegerParameter(0)))); }