Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("load building material in all slots")
- print(" place turtle at bottom right corner (builds in place)")
- print("first wall?")
- local x=tonumber(read())
- print("second wall?")
- local y=tonumber(read())
- print("height?")
- local z=tonumber(read())
- local count=0
- local slot =1
- function ensureSlot()
- if count==0 then
- slot=slot+1;
- count=turtle.getItemCount(slot)
- if count==0 then exit() end
- turtle.select(slot)
- end
- end
- count=turtle.getItemCount(slot)
- turtle.turnRight();turtle.turnRight();
- local zr=0;
- z=z-1
- zr=z %3
- z=math.floor(z/3)
- if (zr~=0) then z=z+1 end
- local buildUp=true;
- local buildForward=true;
- for k=1,z do
- if(k<z) then buildUp=true;buildForward=true;
- elseif zr==1 then buildUp=false;buildForward=false;
- elseif zr==2 then buildUp=false;buildForward=true;
- else buildUp=true ;buildForward=true;
- end
- turtle.up()
- for j=1,2 do
- for i=1,x-2 do
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildUp then
- turtle.placeUp()
- count=count-1;ensureSlot()
- end
- turtle.back()
- if buildForward then
- turtle.place()
- count=count-1;ensureSlot()
- end
- end
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildUp then
- turtle.placeUp()
- count=count-1;ensureSlot()
- end
- turtle.turnLeft()
- turtle.back()
- if buildForward then
- turtle.place()
- count=count-1;ensureSlot()
- end
- for i=1,y-2 do
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildUp then
- turtle.placeUp()
- count=count-1;ensureSlot()
- end
- turtle.back()
- if buildForward then
- turtle.place()
- count=count-1;ensureSlot()
- end
- end
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildForward and j==2 then
- turtle.up()
- turtle.placeDown()
- count=count-1;ensureSlot()
- end
- if buildUp then
- if j==1 then
- turtle.placeUp()
- count=count-1;ensureSlot()
- else
- turtle.up()
- turtle.placeDown()
- count=count-1;ensureSlot()
- end
- end
- turtle.turnLeft()
- turtle.back()
- if buildForward and j==1 then
- turtle.place()
- count=count-1;ensureSlot()
- end
- end
- end
- turtle.forward()
- turtle.up()
- for j=1,y do
- for i=1,x-1 do
- turtle.placeDown()
- count=count-1;ensureSlot()
- turtle.back()
- end
- turtle.placeDown()
- count=count-1;ensureSlot()
- if(j%2== 1) then turtle.turnLeft() else turtle.turnRight() end
- turtle.back()
- if(j%2== 1) then turtle.turnLeft() else turtle.turnRight() end
- --turtle.back()
- end
- if(zr~=0) then z=z-1; end
- z=z*3+zr
- for i=1,z do turtle.down() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement