protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); var charList = new List <CharacterNode>(); var cast = thread.rs().Cast; if (Exist1) { if (AstNode1 is CharacterNode) { charList.Add(AstNode1 as CharacterNode); } else { (AstNode1 as CharacterListNode).Fill(charList); } foreach (var chr in charList) { var name = chr.ToString(); var person = cast[name]; action.Invoke(action.Base(), "ExitScene", Location.Line, person); Context.ActiveCharacters.Remove(chr); } } else { action.Invoke(action.Base(), "ExitSceneAll", Location.Line); Context.ActiveCharacters.Clear(); } return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); var name = AstNode1.ToString(thread); action[name] = action.Base().Invoke("InitializeCharacter", Location.Line, name); thread.rs().Cast.Add(name, action[name]); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action; var person = thread.rs().Cast[AstNode1.ToString()]; action.At(Span).Invoke(action.Base(), "Activate", Location.Line, person); AstNode2.Evaluate(thread); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); var cast = thread.rs().Cast; if (AstNode1 is CharacterNode) { return((Operand)cast[String1].Property("Value")); } else if (AstNode1 is ConstantNode) { return(AstNode1.Evaluate(thread)); } else if (AstNode1 is PronounNode) { return(action.Base().Invoke("ValueOf", Location.Line, AstNode1.Evaluate(thread) as Operand)); } else if (AstNode1 is BinaryOperatorNode) { var operand1 = AstNode2.Evaluate(thread) as Operand; var operand2 = AstNode3.Evaluate(thread) as Operand; // THis is ugly; I apologize var term = Child1.ChildNodes[0].Term.Name; if (term == "the difference between") { return(operand1 - operand2); } else if (term == "the product of") { return(operand1 * operand2); } else if (term == "the quotient between") { return(operand1 / operand2); } else if (term == "the remainder of the quotient between") { return(operand1 % operand2); } else if (term == "the sum of") { return(operand1 + operand2); } } else if (AstNode1 is UnaryOperatorNode) { return(action.Base().Invoke(AstNode1.Evaluate(thread) as String, Location.Line, AstNode2.Evaluate(thread) as Operand)); } else { // error } return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); action.Invoke(action.Base(), "Pop", Location.Line); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); if (AstNode1 is OpenYourNode) { if (String2 == "heart (Keyword)") { action.Invoke(action.Base(), "IntOutput", Location.Line); } else // Open Your Mind { action.Invoke(action.Base(), "CharInput", Location.Line); } } else if (String1 == "speak") { action.Invoke(action.Base(), "CharOutput", Location.Line); } else if (String1 == "listen to") { action.Invoke(action.Base(), "IntInput", Location.Line); } return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); var cond = action.Base().Property("Comp1") == action.Base().Property("Comp2"); return(cond); }
protected override object ReallyDoEvaluate(ScriptThread thread) { Context.CurrentScene = Context.CurrentAct + "_" + scenenumber; thread.rs().Action.At(Span).Label(Context.CurrentScene); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); action.Invoke(action.Base(), "Push", Location.Line, AstNode2.Evaluate(thread) as Operand); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { Context.CurrentAct = actnumber; thread.rs().Action.At(Span).Label(actnumber); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); action.Assign(action.Base().Property("Comp1"), AstNode2.Evaluate(thread) as Operand); action.Assign(action.Base().Property("Comp2"), AstNode4.Evaluate(thread) as Operand); action.Assign(action.Base().Property("TruthFlag"), AstNode3.Evaluate(thread) as Operand); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var cn = TreeNode.ChildNodes; if (Child1.AstNode is CharacterListNode) { cn = Child1.ChildNodes; } var action = thread.rs().Action; foreach (var ch in cn) { var name = ch.AstNode.ToString(); var person = thread.rs().Cast[name]; action.At(Span).Invoke(action.Base(), "EnterScene", Location.Line, person); Context.ActiveCharacters.Add(ch.AstNode as CharacterNode); } return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); if (AstNode1 is NegativeComparativeNode) { return(action.Base().Property("Comp1") < action.Base().Property("Comp2")); } else // PositiveComparativeNode { return(action.Base().Property("Comp1") > action.Base().Property("Comp2")); } }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); if (Child1.Term.Name == "if so") { return(action.Base().Property("TruthFlag")); } else// if not { return(!action.Base().Property("TruthFlag")); } }
protected override object ReallyDoEvaluate(ScriptThread thread) { var action = thread.rs().Action.At(Span); if (AstNode1 is FirstPersonNode || AstNode1 is FirstPersonReflexiveNode) { return(action.Base().Property("FirstPerson")); } else if (AstNode1 is SecondPersonNode || AstNode1 is SecondPersonReflexiveNode) { return(action.Base().Property("SecondPerson")); } return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { if (AstNode1 is UnconditionalSentenceNode) { AstNode1.Evaluate(thread); } else { var action = thread.rs().Action.At(Span); action.If(AstNode1.Evaluate(thread) as Operand); AstNode2.Evaluate(thread); action.End(); } return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { string label; if (AstNode2 is SceneRomanNode) { label = Context.CurrentAct + "_" + AstNode2.ToString(thread).str2varname(); } else { label = AstNode2.ToString(thread).str2varname(); } thread.rs().Action.At(Span).Goto(label); return(base.ReallyDoEvaluate(thread)); }
protected override object ReallyDoEvaluate(ScriptThread thread) { if (AstNode1 is SecondPersonNode) { var action = thread.rs().Action.At(Span); if (AstNode2 is BeNode) { if (AstNode3 is ConstantNode) { action.Invoke(action.Base(), "Assign", Location.Line, AstNode3.Evaluate(thread) as Operand); } else // SECOND_PERSON BE Equality Value StatementSymbol { action.Invoke(action.Base(), "Assign", Location.Line, AstNode4.Evaluate(thread) as Operand); } } else if (AstNode2 is UnarticulatedConstantNode) { action.Invoke(action.Base(), "Assign", Location.Line, AstNode2.Evaluate(thread) as Operand); } } return(base.ReallyDoEvaluate(thread)); }