Advertisement
Guest User

chat

a guest
Oct 11th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. local tMess = {}
  2. chatbox = peripheral.find("chatbox")
  3. if not chatbox then
  4.   error("MoarPeripherals Chatbox is needed.")
  5. end
  6. function b()
  7. while true do
  8. ev, side, playername, mess = os.pullEvent("chat_message")
  9. thing =  playername..": "..mess
  10. local a = http.post("http://minechat.x10host.com/index.php?words="..textutils.urlEncode(thing))
  11. end
  12. end
  13.  
  14. function a()
  15. while true do
  16. local b = http.post("http://minechat.x10host.com/index.php?true=true")
  17. b = b.readAll()
  18. if b ~= tMess[#tMess] then
  19.   tMess[#tMess+1] = b
  20.   chatbox.say(b)
  21. end
  22. end
  23. end
  24.  
  25. parallel.waitForAll(a, b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement