Advertisement
Guest User

readme.md

a guest
Jun 7th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. # KF2AutoAnnouncer
  2. Adds very basic announcement and autoresponder functionality to webinterface. The Webinterface might have a good API but I don't know how to access it, therefore I made a quick and dirty attempt at JavaScript. Since the KF2 Webadmin is based on the UT3 one I guess it can be adapted without much effort. Though there are mutators out there that do a better job, those mutators derank the server. This script works from within the browser and therefore does not derank. The browser can be minimized.
  3.  
  4. I am using this plugin with Tampermonkey 3.11 (http://tampermonkey.net) on Google Chrome 45 but with minor adjustments it should run on Greasemonkey (http://www.greasespot.net) + Firefox too. With some more adjustments it could as well be uploaded on the webserver and embedded in the pages.
  5.  
  6. # What does it do? (right now)
  7. The plugin adds a textarea and some control elements to the maximized chat tab area "/ServerAdmin/current/chat". It moves some items out of the way, increases the available space for messages and leave some for the control elements. The Script helps you with automatically announcing a predefined text and autoresponding to certain chat commands like !help. Each of those two functionalities can be activated and deactivated by using the checkboxes. The checkbox status is shown overhead at the KF2 logo.
  8.  
  9. You can add multiple announcements, by separating the messages with '; ' (semicolon + space). The space is important, because otherwise wink emotes could not be posted and that would be tragic. Autorespond conditions and messages have to be entered inside of the code. The browser window must remain open and Tampermonkey plugin activated for this plugin to work. You can set a timer (post message every x seconds) and a message text. Those can be edited and the changes will effect the messages posted and intervall in between postings, but the settings will reset when closing or reloading the browser window. At the moment you have to edit the script file to save changes.
  10.  
  11. # What could it do? (in the future)
  12. If someone good at tinkering gets to update the script it could be turned into a lower latency auto response and chat command bot. Also mapvote could be implemented so that commands like !mapvote KF-BurningParis, !listmaps, !changemap and many more could work (some like mapchange by sending POST requests to the website). It might be a good alternative until mutators don't derank servers anymore.
  13.  
  14. # How to install?
  15.  
  16. ##Browser:
  17. Get Tampermonkey for Chrome: https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
  18. Or Greasemonkey for Firefox: http://www.greasespot.net/
  19. Install and activate the monkey
  20. Open the raw .js here on GitHub, that should show a message, asking to install the script.
  21. If this doesn't work either create a new script from Monkey menu and copy paste it or download and pull it onto the browser window.
  22.  
  23. Once it is installed you should go into script settings and edit the variables for server_ip, server_port, server_name and. It could look like this:
  24.  
  25. var server_name = 'KarateKid KF2 Server';
  26. var server_ip = 'ijustcant.tekkit.de';
  27. var server_port = 7777;
  28.  
  29. Also if you have a custom webinterface path, you will have to change the Tempermonkey directory filters. Either in the script settings or in the script code, by changing these entries:
  30.  
  31. // @include \*/ServerAdmin/current/chat\*
  32.  
  33. // @match \*/ServerAdmin/current/chat\*
  34.  
  35. ##KF2 Webinterface
  36. I recommend creating a seperate administrator account for the chat bot so you can use your normal admin account while the script is doing its thing and you can give the bot its own name, so it is discernable from your admin account in chat.
  37.  
  38. See screenshots for recommended setup:
  39. http://imgur.com/a/MgXnP
  40.  
  41. Have fun and happy cleaning my messed up code.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement