Created
November 7, 2014 23:36
-
-
Save matdombrock/24e00c8b5d60e07a1860 to your computer and use it in GitHub Desktop.
Build a Pyramid with a building turtle in the MineCraft mod ComputerCraft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b = 0 --bricks laid | |
w = 0 --wall number | |
h = 200 --height of the structure in layers | |
i = 0 --current number layers | |
x = 64--how wide the base should be | |
n = 1 --selection number for inv | |
function start() | |
turtle.up() | |
end | |
function sel() | |
if turtle.getItemCount(n) <1 then--check to see if we are out of material | |
n = n+1 | |
end | |
if n > 16 then --if we are done the last item slot | |
n = 1 --switch back to slot one | |
while turtle.getItemCount(1) <1 do --if there is nothing in slot one ask user to refill | |
print ('please reload, by filling slot one last') | |
sleep(1) | |
end | |
end | |
turtle.select(n)--change slot | |
end | |
function buildlayer() | |
if w == 0 then | |
x = x -1 | |
end | |
while w < 4 do --while we have not built 4 walls yet | |
while b < x do | |
sel() | |
turtle.placeDown() | |
turtle.forward()--build the wall | |
b = b + 1 | |
end | |
while b == x do | |
turtle.turnLeft()--turn so we can build the next wall | |
w = w+1 | |
b = 0 | |
end | |
if w == 3 then | |
x = x-1 | |
end | |
end | |
while w == 4 do | |
turtle.placeDown() | |
turtle.up()--move up so we can start another layer | |
turtle.forward() | |
w = 0 | |
end | |
end | |
start() | |
while i < h do--while we have not reached our intended height | |
buildlayer() | |
i = i+1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment