Advertisement
Guest User

printer

a guest
May 22nd, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1.  
  2. args = {...}
  3. textdata = args[1]
  4.  
  5. slot = 1
  6. blocks = 0
  7.  
  8. function placer(...)
  9.     while turtle.getItemCount(slot) == 0 do
  10.         slot = slot + 1
  11.         if slot == 16 then
  12.             turtle.select(slot)
  13.             turtle.placeUp()
  14.             for i = 1, 15 do
  15.                 turtle.suckUp()
  16.             end
  17.             turtle.digUp()
  18.             slot = 1
  19.         end
  20.         turtle.select(slot)
  21.     end
  22.     turtle.placeDown()
  23. end
  24.  
  25. for i=1,textdata:len() do
  26.     if string.sub(textdata, i, i) == "p" then
  27.         blocks = blocks + 1
  28.     end
  29. end
  30.  
  31. print("Use "..tostring(blocks).." blocks.")
  32. print("That is "..tostring((blocks - blocks % 64) / 64).." stacks and "..tostring(blocks % 64).." blocks.")
  33.  
  34. for i=1,textdata:len() do
  35.     if string.sub(textdata, i, i) == "f" then
  36.         while not turtle.forward() do
  37.             turtle.dig()
  38.             turtle.attack()
  39.         end
  40.     elseif string.sub(textdata, i, i) == "r" then
  41.         turtle.turnRight()
  42.     elseif string.sub(textdata, i, i) == "l" then
  43.         turtle.turnLeft()
  44.     elseif string.sub(textdata, i, i) == "b" then
  45.         turtle.back()
  46.     elseif string.sub(textdata, i, i) == "p" then
  47.         placer()
  48.     elseif string.sub(textdata, i, i) == "u" then
  49.         while not turtle.up() do
  50.             turtle.digUp()
  51.             turtle.attackUp()
  52.         end
  53.     elseif string.sub(textdata, i, i) == "d" then
  54.         while not turtle.down() do
  55.             turtle.digDown()
  56.             turtle.attackDown()
  57.         end
  58.     end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement