Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 2014 (c) psychedelixx
- Minecraft Turtle: Walls
- 2014-03-,0
- Builds a wall e.g. for a house
- Usage:
- - use turtle and type "label set <name>"
- (to give your turtle an unique name so it remembers its programs)
- - type "pastebin get RVrtjU1f walls"
- - type "walls <width> <length> <height>"
- --]]
- slot = 0
- function move()
- if turtle.getItemCount(slot%16+1)==0 then
- slot = slot+1
- turtle.select(slot%16+1)
- end
- turtle.placeDown()
- turtle.dig()
- turtle.forward()
- end
- local args = { ... }
- if #args < 3 then
- print( "Usage: walls <width> <length> <height>" )
- error()
- end
- width = tonumber(args[1])
- length = tonumber(args[2])
- height = tonumber(args[3])
- if turtle.getFuelLevel() < (2*width + 2*length) * height then
- print("I need " .. (2*width + 2*length) * height - turtle.getFuelLevel() .. " fuel.")
- else
- print("======== 2014 (c) psychedelixx ========")
- print("Let's go!")
- turtle.up()
- repeat
- l = 1
- while l < length do
- move()
- l = l + 1
- end
- turtle.turnRight()
- w = 1
- while w < width do
- move()
- w = w + 1
- end
- turtle.turnRight()
- l = 1
- while l < length do
- move()
- l = l + 1
- end
- turtle.turnRight()
- w = 1
- while w < width do
- move()
- w = w + 1
- end
- turtle.up()
- turtle.turnRight()
- height = height - 1
- until height<=0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement