Advertisement
Guest User

autoFarmDrone

a guest
Jun 30th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 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.   senderID, netResp = rednet.receive(3)
  18.   if netResp == "Host Cast" then
  19.     foundHost = true
  20.   else
  21.     if (fAttempt < 50) then
  22.       print("Failed to connect to host, retrying...")
  23.       fAttempt = fAttempt + 1
  24.       print(netResp.." from "..senderID)
  25.       os.sleep(1)
  26.     else
  27.       print("Could not find host.")
  28.       return
  29.     end
  30.   end
  31. end
  32.  
  33. if (foundHost == true) then
  34.   print("Host found, pinging...")
  35. else
  36.   print("Error! Skipped host find!")
  37.   return
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement