private void DoWhile() { //if T equals false, go straight to :endwhile and clear any existing while query, else initialize a while query that collects every single script line that gets executed starting with :while and ending with :endwhile //a exitwhile directly goes to :endwhile and clears the query bool T = CheckCondition(); if (T == true) { ActionScript.CSL().WhileQuery.Clear(); ActionScript.CSL().WhileQueryInitialized = true; } else { ActionScript.CSL().WhileQuery.Clear(); ActionScript.CSL().WhileQueryInitialized = false; //Skip to endwhile: BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; while (oS.ActionScript.Scripts.Count > 0 && oS.ActionScript.Scripts[0].ScriptV2.ScriptType != ScriptTypes.endwhile) { oS.ActionScript.Scripts.RemoveAt(0); } } this.IsReady = true; }
private void DoSelect() { ActionScript.CSL().WhenIndex += 1; BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; oS.ActionScript.Switch(ScriptVersion2.ScriptComparer.EvaluateConstruct(Value)); this.IsReady = true; }
private void DoIf() { bool T = CheckCondition(); ActionScript.CSL().WaitingEndIf[ActionScript.CSL().IfIndex + 1] = false; ActionScript.CSL().CanTriggerElse[ActionScript.CSL().IfIndex + 1] = false; BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; oS.ActionScript.ChooseIf(T); this.IsReady = true; }
public void EndScript(bool forceEnd) { ActionScript.ScriptLevelIndex -= 1; if (ActionScript.ScriptLevelIndex == -1 | forceEnd == true) { ActionScript.ScriptLevelIndex = -1; BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; oS.ActionScript.Scripts.Clear(); oS.ActionScript.reDelay = 1f; this.IsReady = true; Screen.TextBox.ReDelay = 1f; ActionScript.TempInputDirection = -1; ActionScript.TempSpin = false; } }
private void DoExitWhile() { ActionScript.CSL().WhileQuery.Clear(); ActionScript.CSL().WhileQueryInitialized = true; //Skip to endwhile: BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; while (oS.ActionScript.Scripts.Count > 0 && oS.ActionScript.Scripts[0].ScriptV2.ScriptType != ScriptTypes.endwhile) { oS.ActionScript.Scripts.RemoveAt(0); } this.IsReady = true; }
public void Update() { switch (this.ScriptType) { case ScriptTypes.Command: this.DoCommand(); break; case ScriptTypes.@if: this.DoIf(); break; case ScriptTypes.then: this.IsReady = true; break; case ScriptTypes.@else: { BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; oS.ActionScript.ChooseIf(true); this.IsReady = true; } break; case ScriptTypes.endif: { BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; oS.ActionScript.ChooseIf(true); this.IsReady = true; } break; case ScriptTypes.@while: this.DoWhile(); break; case ScriptTypes.endwhile: this.IsReady = true; break; case ScriptTypes.exitwhile: this.DoExitWhile(); break; case ScriptTypes.@select: this.DoSelect(); break; case ScriptTypes.when: { BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; oS.ActionScript.Switch(""); this.IsReady = true; } break; case ScriptTypes.endwhen: { BaseOverworldScreen oS = (BaseOverworldScreen)Core.CurrentScreen; oS.ActionScript.Switch(""); this.IsReady = true; } break; case ScriptTypes.end: this.EndScript(false); break; case ScriptTypes.endscript: this.EndScript(true); break; case ScriptTypes.@return: this.DoReturn(); this.EndScript(false); break; case ScriptTypes.Comment: Logger.Debug("ScriptV2.vb: #Comment: \"" + this.Value + "\""); this.IsReady = true; break; } }