示例#1
0
        public void SymbolBinding()
        {
            //Resolver.DBUG = true;
            ChatRuntime rt  = new ChatRuntime();
            Chat        c1  = rt.AddNewChat("c1");
            var         res = rt.resolver.Bind("Hello $$recur", c1, globals);

            Assert.That(res, Is.EqualTo("Hello A"));
        }
示例#2
0
        /// <summary>
        /// Create a new snapshot with Chat data from the specified runtime
        /// </summary>
        public static Snapshot Create(ChatRuntime rt)
        {
            Snapshot snap = new Snapshot();

            snap.firstChat = rt.firstChat;
            snap.chatData  = new List <ChatData>(rt.Chats().Count);
            rt.Chats().ForEach(c => snap.chatData.Add(ChatData.Create(c)));
            return(snap);
        }
示例#3
0
        public void EmptyGlobalScope()
        {
            //Resolver.DBUG = true;
            ChatRuntime rt = new ChatRuntime();
            Chat        c1 = rt.AddNewChat("c1");

            Assert.Throws <UnboundSymbol>(() =>
                                          rt.resolver.Bind("$animal", c1, null));
        }
示例#4
0
        public void SymbolTraversalSimple()
        {
            Resolver.DBUG = false;
            ChatRuntime rt  = new ChatRuntime();
            Chat        c1  = rt.AddNewChat("c1");
            var         res = rt.resolver.Bind("Hello $fish.name", c1, globals);

            Assert.That(res, Is.EqualTo("Hello Fred"));
        }
示例#5
0
        public void SubstringIssue()
        {
            ChatRuntime rt = new ChatRuntime();

            //Resolver.DBUG = true;
            rt.ParseText("SET $a = A\nSET $b = $a1\nSET $a1 = B\nSAY $a $b\n", true);
            var s = rt.InvokeImmediate(globals);

            Assert.That(s, Is.EqualTo("A B"));
        }
示例#6
0
        public void SimpleLocalScope()
        {
            ChatRuntime rt = new ChatRuntime();
            Chat        c1 = rt.AddNewChat("c1");

            c1.scope.Add("a", "b");
            var res = rt.resolver.Bind("$a", c1, globals);

            Assert.That(res, Is.EqualTo("b"));
        }
示例#7
0
        public void FindAllMultiHard2()
        {
            string[] lines =
            {
                "CHAT c0",
                "FIND {emotion*=(hot|cool), !day =fri}",
                "CHAT c1",
                "CHAT c2 {emotion=hot,day=fri}",
                "CHAT c3 {emotion=dry}",
                "CHAT c4 {emotion=dry,day=fri}",
            };

            string contents = String.Join("\n", lines);

            List <Chat> chats = ChatParser.ParseText(contents, NO_VALIDATORS);
            //chats.ForEach((ch) => Console.WriteLine(ch.ToTree()));
            Command finder = chats[0].commands[0]; finder.Resolve(null);

            Assert.That(chats[0].commands[0].GetType(), Is.EqualTo(typeof(Find)));

            chats = new ChatRuntime(chats).DoFindAll((Find)finder, null);
            //chats.ForEach((obj) => Console.WriteLine(obj.text));

            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(1));

            Assert.That(chats[0], Is.Not.Null);
            Assert.That(chats[0].text, Is.EqualTo("c2"));

            lines = new string[] {
                "CHAT c0 {day=sunday}",
                "FIND {emotion *= (hot|cool|blah), !day*=(fri|wed)}",
                "CHAT c1 {emotion=wet, day = wed }",
                "CHAT c2 {emotion=hot,day=fri}",
                "CHAT c3 {emotion=dry}",
                "CHAT c4 {emotion=cool,day=tues}",
            };

            contents = String.Join("\n", lines);

            chats = ChatParser.ParseText(contents, NO_VALIDATORS);
            //chats.ForEach((ch) => Console.WriteLine(ch.ToTree()));
            finder = chats[0].commands[0]; finder.Resolve(null);
            Assert.That(chats[0].commands[0].GetType(), Is.EqualTo(typeof(Find)));


            chats = new ChatRuntime(chats).DoFindAll((Find)finder, null);
            //chats.ForEach((obj) => Console.WriteLine(obj.text));

            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(1));

            Assert.That(chats[0], Is.Not.Null);
            Assert.That(chats[0].text, Is.EqualTo("c2"));
        }
示例#8
0
        public void FindAllOpsHard()
        {
            string[] lines =
            {
                "CHAT c0",
                "FIND {!dev>1,day=fri}",
                "CHAT c1 {dev=2,day=fri}",
                "CHAT c2 {dev=1,day=fri}",
                "CHAT c3 {}"
            };

            string contents = String.Join("\n", lines);

            List <Chat> chats = ChatParser.ParseText(contents, NO_VALIDATORS);
            //chats.ForEach((ch) => Console.WriteLine(ch.ToTree()));
            Command finder = chats[0].commands[0]; finder.Resolve(null);

            Assert.That(chats[0].commands[0].GetType(), Is.EqualTo(typeof(Find)));
            ChatRuntime cr = new ChatRuntime(chats);

            chats = cr.DoFindAll((Find)finder, null);
            //chats.ForEach((obj) => Console.WriteLine(obj.text));

            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(1));

            Assert.That(chats[0], Is.Not.Null);
            Assert.That(chats[0].text, Is.EqualTo("c1"));

            lines = new[] {
                "CHAT c0",
                "FIND {dev<2,!day=fri}",
                "CHAT c1 {dev=2,day=fri}",
                "CHAT c2 {dev=1,day=fri}",
                "CHAT c3 {}"
            };

            contents = String.Join("\n", lines);

            chats = ChatParser.ParseText(contents, NO_VALIDATORS);
            //chats.ForEach((ch) => Console.WriteLine(ch.ToTree()));
            finder = chats[0].commands[0]; finder.Resolve(null);
            Assert.That(chats[0].commands[0].GetType(), Is.EqualTo(typeof(Find)));
            cr = new ChatRuntime(chats);

            chats = cr.DoFindAll((Find)finder, null);
            //chats.ForEach((obj) => Console.WriteLine(obj.text));

            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(1));

            Assert.That(chats[0], Is.Not.Null);
            Assert.That(chats[0].text, Is.EqualTo("c2"));
        }
示例#9
0
        public void SetChatLocalPath()
        {
            var code = "CHAT c1\nSET $fish.name=Mary\nSAY Hi $fish.name";

            code += "\nCHAT c2\nSET $c1.staleness=2";

            var rt = new ChatRuntime(null);

            rt.ParseText(code, true);

            var chat = rt["c1"];

            Assert.That(chat, Is.Not.Null);
            Assert.That(chat.commands[0].GetType(), Is.EqualTo(typeof(Set)));
            Assert.That(chat.commands[1].GetType(), Is.EqualTo(typeof(Say)));

            chat.Resolve(globals);

            var chat2 = rt["c2"];

            Assert.That(chat2, Is.Not.Null);
            Assert.That(chat2.commands[0].GetType(), Is.EqualTo(typeof(Set)));

            Assert.That(chat.Staleness(), Is.EqualTo(Defaults.CHAT_STALENESS));
            Assert.That(Convert.ToDouble(chat.GetMeta(Meta.STALENESS)), Is.EqualTo(Defaults.CHAT_STALENESS));

            chat2.Resolve(globals);
            Assert.That(chat.Staleness(), Is.EqualTo(2));
            Assert.That(Convert.ToDouble(chat.GetMeta(Meta.STALENESS)), Is.EqualTo(2));


            code  = "CHAT c1\nSET $fish.name=Mary\nSAY Hi $fish.name";
            code += "\nCHAT c2\nSET $c1.stalenessIncr=2";

            rt = new ChatRuntime(null);
            rt.ParseText(code, true);

            chat = rt["c1"];
            Assert.That(chat, Is.Not.Null);
            Assert.That(chat.commands[0].GetType(), Is.EqualTo(typeof(Set)));
            Assert.That(chat.commands[1].GetType(), Is.EqualTo(typeof(Say)));

            chat.Resolve(globals);

            chat2 = rt["c2"];
            Assert.That(chat2, Is.Not.Null);
            Assert.That(chat2.commands[0].GetType(), Is.EqualTo(typeof(Set)));

            // no need to check metadata, except for staleness
            Assert.That(chat.StalenessIncr(), Is.EqualTo(Defaults.CHAT_STALENESS_INCR));
            chat2.Resolve(globals);
            Assert.That(chat.StalenessIncr(), Is.EqualTo(2));
        }
示例#10
0
        /// <summary>
        /// Parse Choice objects from the specified input. Note that for nested groups, only the innermost group will be parsed.
        /// </summary>
        internal static List <Choice> Parse(string input,
                                            Chat context, bool showMatch = false)
        {
            if (context == null || context.runtime == null)
            {
                ChatRuntime.Warn("Choice.Parse got null context/runtime: " + input);
            }
            var choices = new List <Choice>();

            Parse(choices, input, context, showMatch);
            return(choices);
        }
示例#11
0
        public void SaveRestoreChatWithAsk()
        {
            var lines = new[] {
                "CHAT Test {type=a,stage=b}",
                "ASK Is it ok?",
                "OPT yes #next ",
                "OPT no #next",
                "CHAT next {type=a,stage=b}",
                "SAY Done",
            };
            Chat        c1, c2;
            ChatRuntime rtOut, rtIn;

            var text = String.Join("\n", lines);

            rtIn = new ChatRuntime(Client.AppConfig.TAC);
            rtIn.ParseText(text);

            // serialize the runtime to bytes
            var bytes = serializer.ToBytes(rtIn);

            // create a new runtime from the bytes
            rtOut = ChatRuntime.Create(serializer, bytes, AppConfig.TAC);

            // check they are identical
            Assert.That(rtIn, Is.EqualTo(rtOut));

            // double-check the chats themselves
            c1 = rtIn.Chats().First();
            c2 = rtOut.Chats().First();

            //Console.WriteLine(c1.ToTree()+"\n\n"+c2.ToTree());

            Assert.That(c1, Is.EqualTo(c2));
            Assert.That(c1.ToTree(), Is.EqualTo(c2.ToTree()));
            Assert.That(c1.text, Is.EqualTo(c2.text));
            for (int i = 0; i < c1.commands.Count; i++)
            {
                var cmd1 = c1.commands[i];
                Assert.That(cmd1.parent, Is.Not.Null);

                var cmd2 = c2.commands[i];
                Assert.That(cmd2.parent, Is.Not.Null);

                Assert.That(c1.commands[i], Is.EqualTo(c2.commands[i]));
            }

            // no dynamics, so output should be the same
            var res1 = rtIn.InvokeImmediate(globals);
            var res2 = rtOut.InvokeImmediate(globals);

            Assert.That(res1, Is.EqualTo(res2));
        }
示例#12
0
        internal static Chat Create(string name, ChatRuntime rt = null)
        {
            Chat c = new Chat();

            c.Init(name, String.Empty, new string[0]);
            if (rt == null)
            {
                rt = new ChatRuntime();
            }
            rt.Parser().HandleCommand(c);
            return(c);
        }
示例#13
0
        public void ValidateParensTest()
        {
            string[] lines = new[] {
                "CHAT c1",
                "SET ab = (a | b))",
                "SAY $ab"
            };
            ChatRuntime rt = new ChatRuntime();

            rt.ParseText(String.Join("\n", lines), true);
            Assert.Throws <MismatchedParens>(() => rt.InvokeImmediate(globals));
        }
示例#14
0
        public void PartialTransformIssue()
        {
            ChatRuntime rt = new ChatRuntime();

            rt.ParseText("SET $test = (a) (b)\nSAY $test.Cap()", true);
            Assert.That(rt.InvokeImmediate(globals), Is.EqualTo("A b"));

            Resolver.DBUG = false;

            rt = new ChatRuntime();
            rt.ParseText("SET $test = (a | a) (b | b)\nSAY $test.Cap()", true);
            Assert.That(rt.InvokeImmediate(globals), Is.EqualTo("A b"));
        }
示例#15
0
        public static void Main(string[] args)
        {
            //List<Chat> chats = ChatParser.ParseText("PACE 13\nSAY Hello\n");
            List <Chat> chats = ChatParser.ParseFile("gscript.gs");
            ChatRuntime cm    = new ChatRuntime(chats);

            ConsoleClient cl = new ConsoleClient(); // Example client

            cl.Subscribe(cm);                       // Client subscribes to chat events
            cm.Subscribe(cl);                       // Dialogic subscribes to Unity events

            cm.Run();
        }
示例#16
0
        public void FindAll()
        {
            string[] lines =
            {
                "CHAT c1 {day=fri}",
                "CHAT c2 {dev=2,day=fri}",
                "CHAT c3 {}"
            };
            string      contents = String.Join("\n", lines);
            List <Chat> chats    = ChatParser.ParseText(contents, NO_VALIDATORS);
            List <Chat> result   = new ChatRuntime(chats).DoFindAll(null,
                                                                    new Constraint("dev", "1"),
                                                                    new Constraint("day", "fri")
                                                                    );

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count, Is.EqualTo(2));
            Assert.That(result[0].text, Is.EqualTo("c1"));

            Chat c;

            chats       = new List <Chat>();
            chats.Add(c = Chat.Create("c1"));
            chats.Add(c = Chat.Create("c2"));
            c.SetMeta("dev", "1");
            c.SetMeta("day", "hello");
            chats.Add(c = Chat.Create("c3"));
            ChatRuntime cr = new ChatRuntime(chats);

            chats = cr.DoFindAll(null, new Constraint("dev", "1"));
            //chats.ForEach((obj) => Console.WriteLine(obj.text));
            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(3));
            Assert.That(chats[0].text, Is.EqualTo("c2"));

            chats       = new List <Chat>();
            chats.Add(c = Chat.Create("c1"));
            c.SetMeta("dev", "2");
            chats.Add(c = Chat.Create("c2"));
            c.SetMeta("dev", "1");
            c.SetMeta("day", "hello");
            chats.Add(c = Chat.Create("c3"));

            cr    = new ChatRuntime(chats);
            chats = cr.DoFindAll(null, new Constraint("dev", "1"));
            //chats.ForEach((obj) => Console.WriteLine(obj.text));
            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(2));
            Assert.That(chats[0].text, Is.EqualTo("c2"));
            Assert.That(chats[1].text, Is.EqualTo("c3"));
        }
示例#17
0
        public void Staleness()
        {
            Chat        c;
            List <Chat> chats = new List <Chat>();

            chats.Add(c = Chat.Create("c1"));
            c.SetMeta("dev", "hello");
            c.Staleness(2);
            chats.Add(c = Chat.Create("c2"));
            c.SetMeta("dev", "2");
            c.Staleness(3);
            chats.Add(c = Chat.Create("c3"));
            c.SetMeta("dev", "3");
            c.Staleness(4);
            var res = new ChatRuntime(chats).DoFindAll
                          (null, new Constraint(Operator.LT, "staleness", "3"));

            Assert.That(res.Count, Is.EqualTo(1));
            Assert.That(res[0].text, Is.EqualTo("c1"));

            string[] lines =
            {
                "CHAT c0",
                "FIND {dev=1,day=fri,staleness<5}",
                "CHAT c1 {day=fri}",
                "CHAT c2 {dev=2,day=fri}",
                "CHAT c3 {}"
            };

            string contents = String.Join("\n", lines);

            chats = ChatParser.ParseText(contents, NO_VALIDATORS);

            Command finder = chats[0].commands[0]; finder.Resolve(null);

            Assert.That(finder.GetType(), Is.EqualTo(typeof(Find)));

            var crt = new ChatRuntime(chats);

            c = crt.FindChatByLabel("#c1");
            c.Staleness(6);
            Assert.That(c, Is.Not.Null);
            Assert.That(c.text, Is.EqualTo("c1"));

            chats = crt.DoFindAll((Find)finder, null);
            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(1));
            Assert.That(chats[0], Is.Not.Null);
            Assert.That(chats[0].text, Is.EqualTo("c3"));
        }
示例#18
0
        public void BasicFindAll()
        {
            Chat        c;
            List <Chat> chats = new List <Chat>();

            chats.Add(c = Chat.Create("c1"));
            chats.Add(c = Chat.Create("c2"));
            c.SetMeta("dev", "1");
            c.SetMeta("day", "hello");
            chats.Add(c = Chat.Create("c3"));
            Chat res = new ChatRuntime(chats).DoFindAll(null, new Constraint("dev", "1"))[0];

            Assert.That(res.text, Is.EqualTo("c2"));
        }
示例#19
0
        public void ATransformWithinAChoice()
        {
            var         txt = "CHAT c1\nSET a = a ($animal.Cap() | $prep.Cap())\nSAY $a";
            ChatRuntime rt  = new ChatRuntime();

            rt.ParseText(txt);
            Resolver.DBUG = false;
            rt.strictMode = false;
            for (int i = 0; i < 1; i++)
            {
                var s = rt.InvokeImmediate(globals);
                Assert.That(s.IsOneOf(new[] { "a Dog", "a Then" }));
            }
        }
示例#20
0
        internal void Suspend()
        {
            if (chat != null)
            {
                if (!chat.interruptable)
                {
                    ChatRuntime.Warn("Cannot interrupt #" + chat.text);
                    return;
                }
                resumables.Push(chat);

                Info("<#" + chat.text + "-suspending>");
            }
            nextEventTime = -1;
        }
示例#21
0
        private static string DoSay(ChatRuntime rt, string s)
        {
            var globs = new Dictionary <string, object> {
                { "ant", "hello" }
            };

            rt.chats = new Dictionary <string, Chat>();
            rt.ParseText(s);
            Say say = (Dialogic.Say)rt.Chats().First().commands.First();

            say.Resolve(globs);
            s = say.Text();
            //Console.WriteLine(s);
            return(s);
        }
示例#22
0
        public void SerializationPerformance()
        {
            if (!RUN_PROFILING_TESTS)
            {
                return;
            }

            ChatRuntime.DISABLE_UNIQUE_CHAT_LABELS = true;

            ChatRuntime rtOut, rtIn;

            byte[] bytes      = null;
            int    iterations = 10;

            var testfile = AppDomain.CurrentDomain.BaseDirectory;

            testfile += "../../../../dialogic/data/allchats.gs";

            rtIn = new ChatRuntime(Client.AppConfig.TAC);

            var watch = System.Diagnostics.Stopwatch.StartNew();

            for (int i = 0; i < iterations; i++)
            {
                rtIn.ParseFile(new FileInfo(testfile));
            }
            var numChats = rtIn.Chats().Count;

            watch.Stop(); Console.WriteLine("Parsed " + numChats
                                            + " chats in " + watch.ElapsedMilliseconds / 1000.0 + "s");

            for (int i = 0; i < iterations; i++)
            {
                watch = System.Diagnostics.Stopwatch.StartNew();
                bytes = serializer.ToBytes(rtIn);
                watch.Stop();
                Console.WriteLine("Serialize #" + i + ": "
                                  + watch.ElapsedMilliseconds / 1000.0 + "s");
            }

            for (int i = 0; i < iterations; i++)
            {
                watch = System.Diagnostics.Stopwatch.StartNew();
                rtOut = ChatRuntime.Create(serializer, bytes, AppConfig.TAC);
                watch.Stop(); Console.WriteLine("Deserialize #" + i + ": "
                                                + watch.ElapsedMilliseconds / 1000.0 + "s");
            }
        }
示例#23
0
        public void ImmediateSimpleLoop()
        {
            var lines = new[] {
                "CHAT Test {type=a,stage=b}",
                "SAY Find",
                "GO #Test"
            };

            ChatRuntime rt = new ChatRuntime(Client.AppConfig.TAC);

            rt.ParseText(String.Join("\n", lines));

            var s = rt.InvokeImmediate(null);

            // Note: exits before GO to avoid infinite loop
            Assert.That(s, Is.EqualTo("Find\nFind\n\nGO #Test looped"));
        }
示例#24
0
        public void FindAllHard()
        {
            Chat        c;
            List <Chat> chats = new List <Chat>();

            chats.Add(c = Chat.Create("c1"));
            chats.Add(c = Chat.Create("c2"));
            c.SetMeta("dev", "1");
            c.SetMeta("day", "hello");
            chats.Add(c = Chat.Create("c3"));
            ChatRuntime cr = new ChatRuntime(chats);

            chats = cr.DoFindAll(null, new Constraint("dev", "1", ConstraintType.Hard));
            //chats.ForEach((obj) => Console.WriteLine(obj.text));
            Assert.That(chats, Is.Not.Null);
            Assert.That(chats.Count, Is.EqualTo(1));
            Assert.That(chats[0].text, Is.EqualTo("c2"));
        }
示例#25
0
        public void PreloadingTest()
        {
            string[] lines = new[] {
                "CHAT c1",
                "SET ab = hello",
                "SAY $ab $de",

                "CHAT c2 {preload=true}",
                "SET $de = preload",
            };
            ChatRuntime rt = new ChatRuntime();

            rt.ParseText(String.Join("\n", lines), true);
            rt.Preload(globals);

            var s = rt.InvokeImmediate(globals);

            Assert.That(s, Is.EqualTo("hello preload"));
        }
示例#26
0
        public void SubstringSymbolResolve()
        {
            ChatRuntime rt = new ChatRuntime();

            rt.strictMode = false;

            ChatRuntime.SILENT = true;
            Assert.That(DoSay(rt, "SAY $ant $antelope"), Is.EqualTo("hello $antelope"));
            Assert.That(DoSay(rt, "SAY $ant$antelope"), Is.EqualTo("hello$antelope"));
            Assert.That(DoSay(rt, "SAY $ant. $antelope"), Is.EqualTo("hello. $antelope"));
            Assert.That(DoSay(rt, "SAY $ant! $antelope"), Is.EqualTo("hello! $antelope"));
            Assert.That(DoSay(rt, "SAY $ant? $antelope"), Is.EqualTo("hello? $antelope"));
            Assert.That(DoSay(rt, "SAY $ant, $antelope"), Is.EqualTo("hello, $antelope"));
            Assert.That(DoSay(rt, "SAY $ant; $antelope"), Is.EqualTo("hello; $antelope"));
            Assert.That(DoSay(rt, "SAY $ant: $antelope"), Is.EqualTo("hello: $antelope"));
            Assert.That(DoSay(rt, "SAY $ant $ant-"), Is.EqualTo("hello $ant-"));
            Assert.That(DoSay(rt, "SAY $ant $ant_"), Is.EqualTo("hello $ant_"));
            ChatRuntime.SILENT = false;
        }
示例#27
0
        //[Test]
        public void ResumeEventTest()
        {
            string[] lines =
            {
                "CHAT c1 {type=a}",
                "CHAT c2 {type=b,day=fri}",
                "CHAT c3 {type=c,day=thurs}",
            };

            string      contents = String.Join("\n", lines);
            List <Chat> chats    = ChatParser.ParseText(contents, NO_VALIDATORS);
            ChatRuntime rt       = new ChatRuntime(chats);

            for (int i = 0; i < 3; i++)
            {
                EventArgs icu = new ResumeEvent("{}");
                rt.Update(null, ref icu);
            }
        }
示例#28
0
        public void ImmediateModeResume()
        {
            string[] lines =
            {
                "CHAT c",
                "SAY hello",
                "GO #c1",
                "SAY ok",
                "CHAT c1",
                "SAY goodbye"
            };
            ChatRuntime rt = new ChatRuntime();

            rt.ParseText(String.Join("\n", lines));

            var s = rt.InvokeImmediate(globals);

            Assert.That(s, Is.EqualTo("hello\ngoodbye\nok"));
        }
示例#29
0
        public void ImmediateTripleLoop()
        {
            string[] lines =
            {
                "CHAT c1",
                "SAY C1",
                "GO #c2",
                "CHAT c2",
                "SAY C2",
                "GO #c1",
            };

            ChatRuntime rt = new ChatRuntime();

            rt.ParseText(String.Join("\n", lines));

            var s = rt.InvokeImmediate(globals);

            Assert.That(s, Is.EqualTo("C1\nC2\nC1\n\nGO #c2 looped"));
        }
示例#30
0
        internal Chat ToGameObject(ChatRuntime rt)
        {
            ChatParser  parser = rt.Parser();
            LineContext lc     = new LineContext(parser, null, "CHAT", text, null, meta);
            Chat        chat   = (Dialogic.Chat)parser.CreateCommand(lc);

            chat.Staleness(this.staleness);
            chat.Resumable(this.resumable);
            chat.Interruptable(this.interruptable);
            chat.ResumeAfterInterrupting(this.resumeAfterInt);
            chat.StalenessIncr(this.stalenessIncr);

            chat.cursor    = this.cursor;
            chat.lastRunAt = this.lastRunAt;
            chat.allowSmoothingOnResume = this.allowSmoothingOnResume;

            chat.commands = new List <Command>(this.commands.Count);
            this.commands.ForEach(cmd => cmd.ToGameObject(rt));

            return(chat);
        }