Advertisement
Fooksie

EM auto-join for bots

Sep 18th, 2013
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name            EM auto-join for bots
  3. // @description     Auto-joins open games in the current lobby.
  4. // @match           http://www.epicmafia.com/lobby
  5. // ==/UserScript==
  6.  
  7. //Encase script
  8. EMaj=String(function() {
  9.     //Check every 5 seconds
  10.     setInterval(function() {
  11.         //First page
  12.         $.ajax({url:"/game/find?page=1",method:"get"}).success(function(json) {
  13.             //Look for an open table
  14.             json.data.some(function(table) {
  15.                 //Status ID "0" denotes open games (no password)
  16.                 if(table.status_id===0) {
  17.                     //Go to it
  18.                     window.location="/game/"+table.id
  19.                     //Don't continue the loop
  20.                     return true
  21.                     }
  22.                 })
  23.             })
  24.         },5000)
  25.     })
  26.  
  27. //Inject script
  28. script=document.createElement("script")
  29. script.textContent="("+EMaj+")()"
  30. document.body.appendChild(script)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement