Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- uses hobo api t. ver 3.1.1
- local turns = 0
- local height = 0
- local maxheight = 0
- local distance = 1
- local maxdistance = 0
- print("This makes a 4 walls of equal height and length")
- print("It will make right turns at the end of each wall to make a box")
- print("place the turtle on the floor of a corner and make sure the area is clear")
- print("")
- print("How tall should the wall be ?")
- maxheight = tonumber(read())
- print("How long Should the wall be")
- maxdistance = tonumber(read())
- print("The wall will be ".. maxheight.." blocks tall and " .. maxdistance.." blocks long")
- local blockcount = maxheight * maxdistance * 4
- print("The wall needs "..blockcount.." blocks")
- print("Make sure the turtle has fuel and the wall block is in slot 1")
- print("Start Y/N")
- local ready = read()
- if ready ~= "y" and ready ~= "Y" then
- return
- end
- select(1)
- local blockCount = turtle.getItemCount()
- local wallblock = turtle.getItemDetail()
- local selected = {}
- local function findBlock()
- for i = 1 , 16 do
- turtle.select(i)
- if turtle.getItemCount() ~= 0 then
- selected = turtle.getItemDetail()
- if selected.name == wallblock.name then
- blockCount = turtle.getItemCount()
- return
- end
- end
- end
- end
- local function WallUp()
- t.up()
- height = height + 1
- if blockCount == 0 then
- findBlock()
- end
- turtle.placeDown()
- blockCount = blockCount - 1
- end
- -- define wall block
- turtle.select(1)
- -- start
- while turns < 4 do
- while distance ~= maxdistance do
- if height ~= maxheight then
- WallUp()
- else
- t.forward()
- distance = distance + 1
- while height ~= 0 do
- t.down()
- height = height - 1
- end
- end
- end
- turtle.turnRight()
- turns = turns + 1
- distance = 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement