!759 !include #1003380 // Chat !include #1003413 // LooseBot v5 static new Chat chat; static LooseBot dialogBot; static O backend; p { backend = run("#1003384"); OccTree2 tree = goodDialogs2occTree2(printCount("Dialogs", loadDialogs("Color Showing Bot"))); printOccTree2(tree); dialogBot = new LooseBot(tree, func { new WordAdapter }); callOpt(dialogBot, "noRewind"); dialogBot.debug = true; chat.onEnter_post = r { dialogBot.take(E.q(chat.input())); new L l; E e; while ((e = dialogBot.getSingleOutput()) != null) l.add(e); postIt(l); }; 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; } } }