Libraryless. Click here for Pure Java version (3845L/27K/87K).
!7 static volatile long updateInterval = 20000; static volatile long versionCount, lastAutoCheck, lastChange; static volatile long checks; p { addToMultiPort("Version Count Bot."); updateLoop(); } static void updateLoop() { thread "update loop" { while (true) { checkVersionCount(); sleep(updateInterval); } } } static synchronized S answer(S s) { new Matches m; if (match3("check now", s)) checkVersionCount(); if (match3("num checks", s)) ret String.valueOf(checks); if (match3("get version count", s)) return versionCount == 0 ? "hold on, still loading" : format3("version count: *", versionCount); ret null; } static void checkVersionCount() { pcall { ++checks; long newCount = Long.parseLong(loadPageSilently("http://tinybrain.de:8080/tb-int/versioncount.php")); lastAutoCheck = now(); synchronized(main.class) { if (newCount != versionCount) { versionCount = newCount; lastChange = now(); print("Version count updated to " + versionCount + "."); } } } }
Began life as a copy of #1001383
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001745 |
Snippet name: | Version Count Bot (has current total version count from server) |
Eternal ID of this version: | #1001745/3 |
Text MD5: | 31d53a658143215ac854e4f8eeb88932 |
Transpilation MD5: | e34e3b623716536c9c220f1e3db78e61 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-24 16:24:50 |
Source code size: | 1140 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 630 / 2485 |
Version history: | 2 change(s) |
Referenced in: | [show references] |