Advertisement
Rusettsten

MagicBuilder

Oct 3rd, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1.  
  2.  
  3. function refuel()
  4. for i = 1, 16 do -- loop through the slots
  5. turtle.select(i) -- change to the slot
  6. if turtle.refuel(0) then -- if it's valid fuel
  7. turtle.refuel() -- consume half the stack as fuel
  8. end
  9. end
  10. turtle.select(1)
  11. end
  12.  
  13. function wall()
  14. term.clear()
  15. print("Enter length of wall")
  16. wallLength = tonumber(read()) --Gets wall Length from user
  17. print("Enter height of wall")
  18. wallHeight = tonumber(read()) --Gets wall height from user
  19.  
  20. switchCheck = false
  21. startCheck = true
  22. cobbleCount = 0
  23. invCount = 1
  24.  
  25. for i = 1, 16 do -- loop through the slots and get cobblestone
  26. turtle.select(i)
  27. turtle.suckDown(64)
  28. end
  29.  
  30. turtle.select(invCount)
  31.  
  32. for a = 1,wallHeight do
  33.  
  34. if startCheck == false then
  35. turtle.forward()
  36. turtle.turnLeft()
  37. turtle.turnLeft()
  38. turtle.up()
  39. else
  40. startCheck = false;
  41. end
  42.  
  43. for b = 1,wallLength do
  44. if cobbleCount > 64 then
  45. invCount = invCount + 1
  46. turtle.select(invCount)
  47. cobbleCount = 0
  48. end
  49. turtle.forward()
  50. turtle.placeDown()
  51. cobbleCount = cobbleCount + 1
  52. end
  53. end
  54. turtle.forward()
  55. turtle.forward()
  56.  
  57. for i = 1, wallHeight do
  58. turtle.down()
  59. end
  60.  
  61. end
  62.  
  63.  
  64. function platform()
  65. --Platform Builder
  66. term.clear()
  67. print("Enter length (forward) of platform size.")
  68.  
  69. Length = tonumber(read())
  70. print("Enter width (to right) of platform size.")
  71. Width = tonumber(read())
  72.  
  73. switchCheck = false
  74. startCheck = true
  75. cobbleCount = 0
  76. invCount = 1
  77. for i = 1, 16 do -- loop through the slots and get cobblestone
  78. turtle.select(i)
  79. turtle.suckDown(64)
  80. end
  81. turtle.forward()
  82. turtle.down()
  83.  
  84. --Width Loop
  85. for c = 1, Width do
  86. turtle.select(invCount) --Make sure the slot has cobble
  87. if startCheck == false then --Check Startup
  88. if switchCheck == false then
  89. turtle.turnRight()
  90. turtle.forward()
  91. turtle.turnRight()
  92. turtle.forward()
  93. switchCheck = true
  94. else if switchCheck == true then
  95. turtle.turnLeft()
  96. turtle.forward()
  97. turtle.turnLeft()
  98. turtle.forward()
  99. switchCheck = false
  100. end
  101. end
  102. else
  103. startCheck = false;
  104. print("startCheck removed.")
  105. end
  106. --Length loop
  107. for d = 1, Length do
  108. turtle.placeDown()
  109. turtle.forward()
  110. cobbleCount = cobbleCount + 1
  111. if cobbleCount == 64 then --Makes sure it has cobble
  112. invCount = invCount + 1
  113. turtle.select(invCount)
  114. cobbleCount = 0
  115. end
  116. end
  117.  
  118. end -- ends loop
  119. turtle.turnLeft()
  120. turtle.forward()
  121. turtle.forward()
  122. turtle.turnLeft()
  123. turtle.forward()
  124. turtle.forward()
  125. print("Done!")
  126. -- ends program
  127. end
  128.  
  129. print("Welcome to the RUSCOM MagicBuilder.") --BEGIN USER INPUT
  130. print("Commands: 'refuel' , 'platform' , 'wall'")
  131. command = read() --Gets user input
  132.  
  133. if command == "refuel" then --Finds out what the user wants
  134. refuel()
  135. elseif command == "platform" then
  136. platform()
  137. elseif command == "wall" then
  138. wall()
  139. end
  140. shell.run("reboot") --Reboots computer back to menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement