Advertisement
TheProdigy22

print

Mar 13th, 2020
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local args = {...}
  2.  
  3. if #args ~= 1 then
  4.     print("Usage: print <file>")
  5.     return
  6. end
  7.  
  8. local bpFile = fs.open(shell.resolve(args[1]),"r")
  9.  
  10. if not bpFile then
  11.     print("Error: invalid file")
  12.     return
  13. end
  14.  
  15. local blueprint = textutils.unserialize(bpFile.readAll())
  16.  
  17. print("Please put materials in the following slots:")
  18. for i=1,#blueprint.slots do
  19.     print(i..". "..blueprint.slots[i].name..": "..blueprint.slots[i].count)
  20. end
  21. print("Press enter to start...")
  22. read()
  23.  
  24. local i = 1
  25. local right = true
  26. for h=1,blueprint.h do
  27.     turtle.up()
  28.     for x=1,blueprint.x do
  29.         for y=1,blueprint.y do
  30.             if(blueprint.tcode[i] > 0) then
  31.                 turtle.select(blueprint.tcode[i])
  32.                 turtle.placeDown()
  33.             end
  34.             if y < blueprint.y then
  35.                 turtle.forward()
  36.             end
  37.             i = i + 1
  38.         end
  39.         if x < blueprint.x then
  40.             if right then
  41.                 turtle.turnRight()
  42.                 turtle.forward()
  43.                 turtle.turnRight()
  44.                 right = false
  45.             else
  46.                 turtle.turnLeft()
  47.                 turtle.forward()
  48.                 turtle.turnLeft()
  49.                 right = true
  50.             end
  51.         end
  52.     end
  53.     turtle.turnRight()
  54.     turtle.turnRight()
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement