This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
EpicTreeMiner's profile picture

Tower builder!

Started by EpicTreeMiner, 11 January 2013 - 11:13 PM
EpicTreeMiner #1
Posted 12 January 2013 - 12:13 AM
I recently finished the code for a tower builder program. It builds a full circle with a 10 block diameter and then moves up and loops, im working on the setting for a glass block row every 6 rows.
It has about 80 lines of code and you define the height of the tower in the program. It even builds a ladder up the inside edge (in development still)

Thanks
Luke

Finished code:


print("Build tower how high?")
local x = tonumber( read() )
term.clear()
– slotCheck NEEDS cleaning up, help?
function slotCheck()
if turtle.getItemCount(1) <2 then
if turtle.getItemCount(2) <2 then
if turtle.getItemCount(3) <2 then
if turtle.getItemCount(4) <2 then
if turtle.getItemCount(5) <2 then
if turtle.getItemCount(6) <2 then
if turtle.getItemCount(7) <2 then
if turtle.getItemCount(8) <2 then
if turtle.getItemCount(9) <2 then
print("Add Items…")
end
end
end
end
end
end
end
end
end
end
for o = 1,(x) do
slotCheck()
else
for i = 1,4 do
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
end
turtle.up()
end
end

PS. I have only been using lua for 2 days now, thats why this is such a simple program.

http://pastebin.com/n4t0wFMV (Code Link)
Edited on 13 January 2013 - 04:50 AM
remiX #2
Posted 12 January 2013 - 02:30 AM
If there isn't any code, it should go into general until there is code :)/>

Why not post what you have so others can test and give you some feedback?
theoriginalbit #3
Posted 12 January 2013 - 02:38 AM
If there isn't any code, it should go into general until there is code :)/>

Why not post what you have so others can test and give you some feedback?
Because around the time of posting this, he also posted this