Advertisement
Guest User

autoFarmDrone

a guest
Jun 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. -- Establish RedNet Connection --
  2. first = true
  3. while (rednet.isOpen("left") == false) do
  4.   print("Attempting to start RedNet...")
  5.   rednet.open("left")
  6.   if (first) then
  7.     os.sleep(1)
  8.   else
  9.     os.sleep(3)
  10.   end
  11. end
  12. print("RedNet running.")
  13. print("Establishing connection to host...")
  14.  
  15. foundHost = false; fAttempt = 0;
  16. while (foundHost == false) do
  17.   netResp = rednet.receive(3)
  18.   if netResp == "Host Cast" then
  19.     foundHost = true
  20.   else
  21.     if (fAttempt < 5) then
  22.       print("Failed to connect to host, retrying...")
  23.       fAttempt = fAttempt + 1
  24.       os.sleep(1)
  25.     else
  26.       print("Could not find host.")
  27.       return
  28.     end
  29.   end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement