Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local go = { ... }
- local height = 1
- local length1 = 0
- local length2 = 0
- local icount = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
- local islot = 1
- local n = 0
- local x = 1
- local z = 1
- local y = 1
- local side = 1
- local dist = 0
- if #go == 1 then
- length1 = tonumber(go[1])
- length2 = tonumber(go[1])
- elseif #go == 2 then
- length1 = tonumber(go[1])
- length2 = tonumber(go[2])
- elseif #go == 3 then
- length1 = tonumber(go[1])
- length2 = tonumber(go[2])
- height = tonumber(go[3])
- else
- print ("Usage: length,width,height(optional)")
- return
- end
- print("Length:",length1," Width:",length2," Height:",height)
- turtle.forward()
- function buildlong()
- dist = length1
- moving()
- end
- function buildwide()
- if side == 4 then
- print("side4")
- dist = length2 - 1
- else
- dist = length2
- end
- moving()
- end
- function moving()
- print("moving")
- if turtle.getItemCount(islot) ~= 0 then
- turtle.placeDown()
- dist = dist - 1
- print(dist)
- if dist == 0 then
- if side ~= 4 then
- turtle.turnRight()
- else
- turtle.forward()
- turtle.turnRight()
- end
- side = side + 1
- if (side == 2) or (side == 4) then
- buildwide()
- elseif side == 3 then
- buildlong()
- else
- if y == height then
- print("almost")
- ENDit()
- else
- side = 1
- y = y + 1
- turtle.up()
- buildlong()
- end
- end
- else
- end
- turtle.forward()
- moving()
- else
- slotselect()
- end
- end
- function slotselect()
- print("slotselect")
- sleep(1)
- islot = 1
- while turtle.getItemCount(islot) == 0 do
- while islot == 16 do
- print("Press E to quit or C to continue.")
- local event, key = os.pullEvent("char") -- limit os.pullEvent to the 'key' event
- if key == keys.e then -- if the key pressed was 'e'
- print("You pressed E. Ending...")
- ENDit()
- elseif key == keys.c then
- print("Moving On")
- slotselect()
- else
- end
- end
- islot = islot + 1
- end
- turtle.select(islot)
- moving()
- end
- function ENDit()
- print("Done")
- os.reboot()
- end
- buildlong()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement