Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --CurrentLuaProgram.lua
- print("Hello World")
- --TurtleTower
- --Check arguments for correct formatting
- local args = { ... }
- if #args ~= 1 then --Check if it's not exactly 3 arguments.
- shell.run("clear")
- print("Invalid number of arguments")
- print("turtletower [height]")
- do return end
- end
- for i = 1, 1 do --Step through each argument and make sure it is a number greater than 1.
- if tonumber(args[i]) < 2 then
- shell.run("clear")
- print("Invalid arguments")
- print("All measurements must be numbers greater than 1")
- do return end
- end
- end
- --------------------------------------------------
- --commandline arguments [height]
- length = tonumber(args[1]) --length of square
- slotnum = 1
- --------------------------------------------------
- for i = 1, length do
- if not turtle.detectUp() then
- turtle.up()
- end
- for j = 1, 4 do
- for k = 1, 3 do
- if not turtle.detectDown() then
- if turtle.getItemCount(slotnum) < 1 then
- slotnum = slotnum + 1
- turtle.select(slotnum)
- end
- turtle.placeDown()
- end
- turtle.forward()
- end
- turtle.turnRight()
- turtle.forward()
- end
- end
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- for i = 1, length do
- turtle.down()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.up()
- turtle.dig()
- turtle.down()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- for i = 1, length do
- turtle.up()
- turtle.forward()
- if turtle.getItemCount(slotnum) < 1 then
- slotnum = slotnum + 1
- turtle.select(slotnum)
- end
- turtle.placeDown()
- turtle.forward()
- if turtle.getItemCount(slotnum) < 1 then
- slotnum = slotnum + 1
- turtle.select(slotnum)
- end
- turtle.placeDown()
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment