Occurs when scripter changes state.public event ChangeStateHandler OnChangeState public class ChangeStateEventArgs: System.EventArgs { public ScripterState OldState; public ScripterState NewState; } public enum ScripterState { None, Init, // scripter does not contain any module ReadyToCompile, // contains modules and code Compiling, // compiles ReadyToLink, // ready to link Linking, // linkes compiled code ReadyToRun, // ready to run Running, // runs program Terminated, // program has been terminated Paused, // program has been paused Error // error has raised };
Example
private void ChangeState(PaxScripter sender, PaxScript.Net.ChangeStateEventArgs e) { if (e.OldState == ScripterState.Init && e.NewState == ScripterState.ReadyToCompile) { sender.AddModule("1"); sender.AddCodeFromFile("1", "hello.cs"); } else if (e.OldState == ScripterState.ReadyToRun) { sender.AddBreakpoint("1", 13); } else if (e.NewState == ScripterState.Error) { ShowErrors(sender); } }