static Object addToMultiPort_responder; static long addToMultiPort(final S botName) { ret addToMultiPort(botName, new Object() { public S answer(S s, L history) { S answer = cast callOpt(getMainClass(), "answer", s, history); if (answer != null) ret answer; answer = (S) callOpt(getMainClass(), "answer", s); if (answer != null) ret answer; if (match3("get injection id", s)) ret getInjectionID(); ret null; } }); } static long addToMultiPort(final S botName, final O responder) { //print(botName); addToMultiPort_responder = responder; startMultiPort(); L ports = getMultiPorts(); if (ports == null) ret 0; if (ports.isEmpty()) fail("No multiports!"); if (ports.size() > 1) print("Multiple multi-ports. Using last one."); O port = last(ports); O responder2 = new O() { public S answer(S s, L history) { if (match3("get injection id", s)) ret getInjectionID(); if (match3("your name", s)) ret botName; ret (S) call(responder, "answer", s, history); } }; record(responder2); ret (Long) call(port, "addResponder", botName, responder2); }