Advertisement
k_goos

Quarry

Apr 24th, 2013
40
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local par1 = ""
  2. local par2 = 0
  3. local par3 = ""
  4. local args = {...}
  5.  
  6. function ServerSendResponse()
  7. while true do
  8. rednet.send(par2, par1)
  9. end
  10. end
  11. function ServerReceive()
  12. while true do
  13. id, mess = rednet.receive()
  14. if id == par2 then
  15. par3 = mess
  16. return
  17. end
  18. end
  19. end
  20.  
  21. function Quarry(Count)
  22. par2, mess = rednet.receive()
  23. if mess == "quarry0808" then
  24. print("New quarry: "..par2)
  25.  
  26. while par3 == "countplease" do
  27. par1 = "quarry0808"
  28. parallel.waitForAny(ServerSendResponse, ServerReceive)
  29. end
  30.  
  31. rednet.send(id, count)
  32. end
  33. end
  34.  
  35. rednet.open("top")
  36. if #args > 1 or #args < 1 then
  37. print("Invalid number of arguments.")
  38. else
  39. count = args[1]
  40. Quarry(count)
  41. end
  42. rednet.close("top")
Advertisement
RAW Paste Data Copied
Advertisement