Advertisement
SuperRavenSn1per

TurtleShell Turtle

Mar 30th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. rednet.open("left")
  2.  
  3. function centerPrint(txt)
  4.   w, h = term.getSize()
  5.   term.setCursorPos(w / 2 - math.floor(string.len(txt) / 2), h / 2)
  6.   print(txt)
  7. end
  8.  
  9. term.setBackgroundColor(colors.white)
  10. term.setTextColor(colors.blue)
  11. term.clear()
  12. term.setCursorPos(1,1)
  13. centerPrint("Waiting for server...")
  14. rednet.broadcast("hello?")
  15. id, msg = rednet.receive("im here!", 5)
  16.  
  17. if msg == "im here!" then
  18.   term.clear()
  19.   centerPrint("Server found!")
  20. else
  21.   term.setTextColor(colors.white)
  22.   term.setBackgroundColor(colors.red)
  23.   term.clear()
  24.   print("Server not found or invalid server contacted.")
  25.   sleep(4)
  26.   os.reboot()
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement