Advertisement
Guest User

HQ

a guest
Apr 21st, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. shell.run("wget http://regex.info/code/JSON.lua")
  2. local mon = peripheral.find("monitor")
  3. mon.setCursorPos(1,1)
  4. local xm, ym = mon.getSize()
  5. JSON = (loadfile "JSON.lua")()
  6. local ws, err = http.websocket("wss://ws.hqt.space")
  7. if not ws then
  8.   printError(err)
  9. else
  10. while true do
  11.     local msg = JSON:decode(ws.receive())
  12.     term.redirect(mon)
  13.     if msg.type == "status" then
  14.   term.setBackgroundColor(colors.black)
  15.   term.clear()
  16.   print(msg.message)
  17.   local x, y = term.getCursorPos()
  18.   paintutils.drawLine(1, y, xm, y, colors.green)
  19.     end
  20.     term.redirect(term.native())
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement