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

Extremely Simple 3x3 ladder+tower builder

Started by Vliekkie, 30 March 2012 - 04:35 PM
Vliekkie #1
Posted 30 March 2012 - 06:35 PM
I got a sugestion from Wolvan to create a program that builds a 3x3 thingy that has a ladder in the middle like this
And as a bonus the layout of the slots looks exactly the same.. gewd 4 sempl mynds :o/>/>

AXA A=Anything.. even air if u want to save blocks or keep it simple
ALA L=Ladder
SAA S=Startpoint.. it faces north according to this program X= Any block that a ladder can hold on to..

Here's the code

SpoilerVliekkie's ladder tower builder V1.0
term.clear()
term.setCursorPos(1,1)
print("This program builds a ladder on a flat 3x3 surface surounded by a shell in the following format at a height of ur choosing.")
print("Press any button to continue")
os.pullEvent(key)
term.clear()
term.setCursorPos(1,1)
print("use the following format and fill your slots. A,S = your own Block choice. X= Ladder suportable block  L=ladder and S=startpoint")
term.setCursorPos(1,6)
print("AXA")
print("ALA")
print("SAA")
print("How high do you want to go?")
h=tonumber(read())
x=0
	while x<h do
	x=x+1


turtle.up()
if turtle.getItemCount(7)>0 then
turtle.select(7)
turtle.placeDown()
end
turtle.forward()
if turtle.getItemCount(4)>0 then
turtle.select(4)
turtle.placeDown()
end
turtle.forward()
if turtle.getItemCount(1)>0 then
turtle.select(1)
turtle.placeDown()
end
turtle.turnRight()
turtle.forward()
turtle.turnRight()
if turtle.getItemCount(2)>0 then
turtle.select(2)
turtle.placeDown()
end
turtle.forward()
turtle.forward()
if turtle.getItemCount(8)>0 then
turtle.select(8)
turtle.placeDown()
end
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
if turtle.getItemCount(5)>0 then
turtle.select(5)
turtle.placeDown()
end
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
if turtle.getItemCount(9)>0 then
turtle.select(9)
turtle.placeDown()
end
turtle.forward()
if turtle.getItemCount(6)>0 then
turtle.select(6)
turtle.placeDown()
end
turtle.forward()
if turtle.getItemCount(3)>0 then
turtle.select(3)
turtle.placeDown()
end
turtle.turnLeft()
	turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.turnLeft()
end
turtle.back()
y=2
while y<h do
turtle.down()
end


ENJOY!!!

Plz gimme props if you use this.. AND if you think this could be easier.. plz .. critisism is DEMANDED.. lol jk.. it would still be nice though..

heres a pic

Spoiler
Wolvan #2
Posted 30 March 2012 - 07:22 PM
Didn't I suggest that?
TheDeathOfRandom #3
Posted 31 March 2012 - 05:45 AM
other than some simple functions this count get any simpler :o/>/> i like it

heres an example of a function btw

function useItem()
turtle.forward()
if turtle.getItemCount(x)>0 then
turtle.select(x)
turtle.placeDown()
end
end

ex script

repeat
local x = 1
useItem()
until turtle.getItemCount(x) == 0

repeat
local x = 2
useItem()
until turtle.getItemCount(x) == 0


Could get even simpler but this is just an example
Vliekkie #4
Posted 31 March 2012 - 06:32 PM
oh yah.. functions.. forgot that
BUT.. how to get it to not place something if u leave a slot open?
bum bum bum buuuuum