!752 !include #1003380 // Chat !include #1003370 // LooseBot static new Chat chat; static LooseBot dialogBot; static O backend; p { backend = run("#1003384"); OccTree tree = dialogs2occTree(printCount("Dialogs", loadDialogs("Color Showing Bot"))); printOccTree(tree); dialogBot = new LooseBot(tree); dialogBot.debug = true; chat.onEnter_post = r { postIt(dialogBot.handle(ll(E.q(chat.input())))); }; showFrame("Chat with " + programTitle(), chat); chat.requestFocus(); } svoid postIt(final L l) { for (int i = 0; i < l(l); i++) { E e = l.get(i); if (e.a()) chat.append("Bot: " + e.a + "\n"); else if (e.state()) { chat.append("[" + e.state + "]\n"); final int _i = i; Runnable l8r = r { postIt(subList(l, _i)); }; if ((bool) call(backend, "action", e.state, l8r)) break; } } }