Advertisement
Guest User

startup

a guest
Nov 29th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. t = peripheral.wrap("right")
  3. term.clear()
  4. term.setCursorPos(2,2)
  5. term.setBackgroundColor(colors.white)
  6. term.clearLine()
  7. term.setCursorPos(2,2)
  8. term.setTextColor(colors.gray)
  9. write("Turtle Teleportation Controller")
  10. term.setCursorPos(2,4)
  11. term.setBackgroundColor(colors.black)
  12. term.setTextColor(colors.white)
  13. write("X: ")
  14. x,y = term.getCursorPos()
  15. term.setCursorPos(2,5)
  16. write("Y: ")
  17. term.setCursorPos(2,6)
  18. write("Z: ")
  19. term.setTextColor(colors.lightGray)
  20. term.setCursorPos(x,4)
  21. posX = read()
  22. term.setCursorPos(x,5)
  23. posY = read()
  24. term.setCursorPos(x,6)
  25. posZ = read()
  26. term.setCursorPos(2,8)
  27. if not tonumber(posX) then
  28.   os.shutdown()
  29. end
  30. if not tonumber(posY) then
  31.   os.shutdown()
  32. end
  33. if not tonumber(posZ) then
  34.   os.shutdown()
  35. end
  36. posX = tonumber(posX)
  37. posY = tonumber(posY)
  38. posZ = tonumber(posZ)
  39. term.setTextColor(colors.white)
  40. write("Required Fuel: ")
  41. term.setTextColor(colors.lightGray)
  42. local fuel = tostring(t.requiredFuel(posX,posY,posZ))
  43. write(fuel)
  44. timer = 5
  45. while true do
  46.   term.setCursorPos(2,10)
  47.   term.setTextColor(colors.white)
  48.   term.clearLine()
  49.   term.setCursorPos(2,10)
  50.   term.setTextColor(colors.white)
  51.   write("Teleporting in ")
  52.   term.setTextColor(colors.lightGray)
  53.   write(timer)
  54.   sleep(1)
  55.   timer = timer - 1
  56.   if timer <= 0 then
  57.     break
  58.   end
  59. end
  60. term.setCursorPos(2,12)
  61. term.setTextColor(colors.white)
  62. local tp = t.teleportTo(posX,posY,posZ)
  63. if tp then
  64.   write("Teleportation Successful!")
  65. else
  66.   write("Teleportation Failed.")
  67. end
  68. sleep(12)
  69. os.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement