daily pastebin goal
57%
SHARE
TWEET

Companion Ladder Placing

a guest Nov 3rd, 2012 4,298 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. print("This program will place ladders straight down on the block it's facing")
  4. print("")
  5. print("It will also attempt to fill gaps with a material")
  6. print("")
  7. print("Place fuel in the bottom left")
  8. print("Place ladders in the top left")
  9. print("And place building material beside the ladders")
  10. print("Press any key when ready or press o to quit")
  11. key = os.pullEvent("char")
  12. if key ~= "o" then
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. ladders = turtle.getItemCount(1)
  16. blocks = turtle.getItemCount(2)
  17. Nfuel = turtle.getItemCount(16)
  18. fuel = turtle.getFuelLevel()
  19. dist = 0
  20.  
  21. --Getting Fuel
  22. Cfuel = 0
  23. while Cfuel == 0 do
  24. while fuel < 200 do
  25. fuel = turtle.getFuelLevel()
  26. turtle.select(16)
  27. turtle.refuel(1)
  28. Nfuel = turtle.getItemCount(16)
  29. if Nfuel == 0 then
  30. print("Add More Fuel")
  31. print("Press any key when done")
  32. os.pullEvent("char")
  33. Nfuel = turtle.getItemCount(16)
  34. end
  35. end
  36. Cfuel = 1
  37. print("Successfully Fueled!")
  38. end
  39.  
  40. turtle.forward()
  41. turtle.turnRight()
  42. turtle.turnRight()
  43. turtle.back()
  44. while turtle.down() and ladders ~= 0 do
  45. dist = dist + 1
  46. turtle.select(1)
  47. if turtle.place() == false and dist > 2 then
  48. if not turtle.detect() then
  49. turtle.forward()
  50. turtle.select(2)
  51. turtle.place()
  52. turtle.back()
  53. turtle.place()
  54. end
  55. end
  56. ladders = ladders - 1
  57. end
  58. for i=1, dist do
  59. turtle.up()
  60. end
  61. if ladders == 0 then
  62. turtle.up()
  63. end
  64. turtle.forward()
  65. turtle.forward()
  66. turtle.turnRight()
  67. turtle.turnRight()
  68. else
  69. print("Goodbye")
  70. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top