Uses 3874K of libraries. Click here for Pure Java version (9261L/64K/218K).
!7 concept Config { new L<S> bots; /* contains program IDs */ } static L<Pair<S, Class>> bots = synchroList(); // pair(program ID, main class) static JList lCommands, lBots; p-subst { db(); loadBots(); if (isMainProgram()) { swing { addToWindowSplitRight_aggressive(consoleFrame(), jvsplit( withMargin(withCenteredTitle("Bots", lBots = jlist())), withMargin(withCenteredTitle("Commands", lCommands = jlist_dragEnabled())))); awtCalcEvery(lBots, 1000, f updateBotsList); centerConsole(600, 600); } updateCommandList(); focusConsole(); botSleep(); } } svoid loadBots { cleanUpAndClear(bots); for (S x : config().bots) bots.add(pair(x, runSubBot(x))); updateCommandList(); } answer { lock dbLock(); if "add bot *" { setAddOrMoveToFront(config().bots, formatSnippetID($1)); config().change(); loadBots(); ret "OK"; } if "remove bot *" { config().bots.remove(formatSnippetID($1)); config().change(); loadBots(); ret "OK"; } if "list bots" ret sfu(config().bots); try answer scanMultipleBots(secondOfPairs(bots), s); } svoid updateCommandList { fillListWithStrings(lCommands, knownCommands()); } svoid updateBotsList { fillListWithStrings(lBots, snippetsWithTitles(firstOfPairs(bots))); } static L<S> knownCommands() { ret getSupportedQuestions_multipleBots(concatLists(ll(mc()), secondOfPairs(bots))); } static Config config() { ret uniq_sync(Config); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009323 |
Snippet name: | MultiBot with commands + bots list [WORKS] |
Eternal ID of this version: | #1009323/38 |
Text MD5: | 4371bbd536ce38b79ed8ef6b79adf580 |
Transpilation MD5: | 97d752e05f0be1fbe70659da4879fe62 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-07-24 16:48:30 |
Source code size: | 1482 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 573 / 864 |
Version history: | 37 change(s) |
Referenced in: | #1009335 - Simple MultiBot, first version [backup] |