Advertisement
programcreator

Turtle: Wall

Jan 27th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. args = {...}
  2. items = 0
  3. currSlot = 1
  4. le = args[2]
  5. turtle.select(1)
  6.  
  7. function slot()
  8.   if turtle.getItemCount(currSlot) == 0 then
  9.     currSlot = currSlot + 1
  10.     turtle.select(currSlot)
  11.   end  
  12. end
  13.  
  14. function fuel()
  15.   if turtle.getFuelLevel() <=2 then
  16.     turtle.select(16)
  17.     turtle.refuel(1)
  18.     turtle.select(currSlot)
  19.   end
  20. end
  21.  
  22. function up()
  23.   for i = args[1],2,-1 do
  24.     fuel()
  25.     turtle.up()
  26.     turtle.placeDown()
  27.     slot()
  28.   end
  29.   fuel()
  30.   turtle.back()
  31.   turtle.place()
  32.   slot()
  33.   le = le - 1
  34. end
  35.  
  36. function down()
  37.   while not turtle.detectDown() do
  38.     fuel()
  39.     turtle.down()
  40.     turtle.placeUp()
  41.     slot()
  42.   end
  43.   fuel()
  44.   turtle.back()
  45.   turtle.place()
  46.   slot()
  47.   le = le - 1
  48. end
  49.  
  50. while le ~= 0 do
  51.   up()
  52.   if le ~= 0 then
  53.     down()
  54.   end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement