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

Torch placing =S

Started by zazarath, 03 January 2013 - 05:43 AM
zazarath #1
Posted 03 January 2013 - 06:43 AM
hi there i realy new to programing and i made my first tunneling program i did this becase i got sick of diging 100 blocks around lava to retrive my turtle =P

this is my program so far, sorry if it messy codeing but i am new =P
"
print ("How Long?")
digdig = io.read()
x = 0
y = tonumber(digdig)

while x < y do
while not turtle.forward() do
turtle.dig()
end

while turtle.detectUp() do
turtle.digUp()
end
x = x + 1

end

x = 1

turtle.turnLeft()
while not turtle.forward() do
turtle.dig()
end
turtle.turnLeft()
while turtle.detectUp() do
turtle.digUp()
end


while x < y do
while not turtle.forward() do
turtle.dig()
end
while turtle.detectUp() do
turtle.digUp()
end
x = x + 1
end


turtle.turnLeft()
turtle.turnLeft()
print("All Done")
"

and i tryign to figer out how to get it to place a tourch every 5 blocks, i know thats over kill but i like tourchs =P
all i can think of is somethign like

if x == 5 or 10 or 15 then
turtle.select(1)
turtle.placeUp()
end

but ofc thats going to limit the program to 15 blocks (that bit of codes probs wrong i know you can do somthign like that)

also i think my io.read bit could be smaller i think its
y = tonumber(oi.read())
Lyqyd #2
Posted 03 January 2013 - 07:09 AM

if x % 5 == 0 then --if x divided by five has a remainder of 0
zazarath #3
Posted 03 January 2013 - 07:32 AM
Thannk you soo much =) been looking everywhere for that


if x % 5 == 0 then --if x divided by five has a remainder of 0