x = 64
if x <5 then
getfuel()
refuel()
tunnel()
end
else if x >5
getfuel()
refuel()
down()
empty()
end
end
how would i make this loop endlessly?
x = 64
if x <5 then
getfuel()
refuel()
tunnel()
end
else if x >5
getfuel()
refuel()
down()
empty()
end
end
while true do
--code here
end
local isOn = true
while isOn do
--code here
--if something then isOn = false end
end
x = 64
while true do
if x <5 then
getfuel()
refuel()
tunnel()
end
else if x >5
getfuel()
refuel()
down()
empty()
end
end
end
dose not work
x = 64
while true do
if x <5 then
getfuel()
refuel()
tunnel()
elseif x >5 then
getfuel()
refuel()
down()
empty()
end
end
I made that part work,,, dident see edit, you need to add a end to the while loopdose not workx = 64 while true do if x <5 then getfuel() refuel() tunnel() end else if x >5 getfuel() refuel() down() empty() end end end
x = 64
while true do
if x <5 then
getfuel()
refuel()
tunnel()
elseif x >5 then
getfuel()
refuel()
down()
empty()
end
end
dose not workx = 64 while true do if x <5 then getfuel() refuel() tunnel() end else if x >5 getfuel() refuel() down() empty() end end end
If you use 'else if' then don't close the previous 'if then' with an end. So it would be like this:x = 64 while true do if x <5 then getfuel() refuel() tunnel() else if x >5 then getfuel() refuel() down() empty() end end
Also, 'else if' needs a 'then' after it. You also had an 'end' to many at the bottom.
EDIT: I've been ninja'd like a pro >.<
EDIT2: sjele forgot the 'then' after the 'else if' line though
dose not workx = 64 while true do if x <5 then getfuel() refuel() tunnel() end else if x >5 getfuel() refuel() down() empty() end end end
If you use 'else if' then don't close the previous 'if then' with an end. So it would be like this:x = 64 while true do if x <5 then getfuel() refuel() tunnel() elseif x >5 then getfuel() refuel() down() empty() end end
Also, 'else if' needs a 'then' after it. You also had an 'end' to many at the bottom.
EDIT: I've been ninja'd like a pro >.<
EDIT2: sjele forgot the 'then' after the 'else if' line though
dose not workx = 64 while true do if x <5 then getfuel() refuel() tunnel() end else if x >5 getfuel() refuel() down() empty() end end end
If you use 'else if' then don't close the previous 'if then' with an end. So it would be like this:x = 64 while true do if x <5 then getfuel() refuel() tunnel() elseif x >5 then getfuel() refuel() down() empty() end end
Also, 'else if' needs a 'then' after it. You also had an 'end' to many at the bottom.
EDIT: I've been ninja'd like a pro >.<
EDIT2: sjele forgot the 'then' after the 'else if' line though
function getfuel()
turtle.select(15)
turtle.placeUp()
turtle.select(14)
turtle.suckUp(5)
turtle.select(15)
turtle.digUp()
end
function refuel()
if turtle.getFuelLevel() < 10 then
turtle.select(14)
turtle.refuel(1)
end
end
function digup()
turtle.digUp()
turtle.up
x= x+1()
end
x=0
while x <= 63 do
getfuel()
refuel()
digUp90
end
end
x= x+1()
So when did you define the answer of x+1 to be a function?break
is alot easier
function refuel()
if turtle.getFuelLevel() < 10 then
turtle.select(14)
turtle.refuel(1)
end
end
function down()
turtle.digDown()
turtle.turnLeft()
turtle.dig()
turtle.turnRight(2)
turtle.dig()
turtle.turnLeft()
turtle.dig()
shell.run("tunnel", "5")
turtle.back (4)
x = x-1
end
function tunnel ()
getfuel()
turle.refuel()
shell.run ("tunnel", "10")
end
function empty()
turtle.select(16) turtle.placeUp()
turtle.select(2) turtle.dropUp()
turtle.select(3) turtle.dropUp()
turtle.select(4) turtle.dropUp()
turtle.select(5) turtle.dropUp()
turtle.select(6) turtle.dropUp()
turtle.select(7) turtle.dropUp()
turtle.select(8) turtle.dropUp()
turtle.select(9) turtle.dropUp()
turtle.select(10) turtle.dropUp()
turtle.select(11) turtle.dropUp()
turtle.select(12) turtle.dropUp()
turtle.select(13) turtle.dropUp()
turtle.select(14) turtle.dropUp()
turtle.select(1) turtle.dropUp()
turtle.select(16)
turtle.digUp()
endfunction getfuel()
turtle.select(15)
turtle.placeUp()
turtle.select(14)
turtle.suckUp(5)
turtle.select(15)
turtle.digUp()
end
print "you need 2 ender chest slots 15 and 16 and 3 fuel in 14"
x = 64
while true do
if x <5 then
getfuel()
refuel()
tunnel()
else if x >5 then
getfuel()
refuel()
down()
empty()
end
end
end
turtle.select(2) turtle.dropUp()
turtle.select(3) turtle.dropUp()
turtle.select(4) turtle.dropUp()
turtle.select(5) turtle.dropUp()
turtle.select(6) turtle.dropUp()
turtle.select(7) turtle.dropUp()
turtle.select(8) turtle.dropUp()
turtle.select(9) turtle.dropUp()
turtle.select(10) turtle.dropUp()
turtle.select(11) turtle.dropUp()
turtle.select(12) turtle.dropUp()
turtle.select(13) turtle.dropUp()
turtle.select(14) turtle.dropUp()
turtle.select(1) turtle.dropUp()
Can befor i=2,14 do
turtle.select(1)
turtle.dropUp()
end
turtle.select(1)
turtle.dropUp()
btw, please indentate your code abit more, making blanklines is part of indentation just as well as tabs(I don't really know nif it's part of indentations but hell yeah it makes your code more readable).Can beturtle.select(2) turtle.dropUp() turtle.select(3) turtle.dropUp() turtle.select(4) turtle.dropUp() turtle.select(5) turtle.dropUp() turtle.select(6) turtle.dropUp() turtle.select(7) turtle.dropUp() turtle.select(8) turtle.dropUp() turtle.select(9) turtle.dropUp() turtle.select(10) turtle.dropUp() turtle.select(11) turtle.dropUp() turtle.select(12) turtle.dropUp() turtle.select(13) turtle.dropUp() turtle.select(14) turtle.dropUp() turtle.select(1) turtle.dropUp()
btw, please indentate your code abit more, making blanklines is part of indentation just as well as tabs(I don't really know nif it's part of indentations but hell yeah it makes your code more readable).for i=2,14 do turtle.select(1) turtle.dropUp() end turtle.select(1) turtle.dropUp()
But yeah, overall great code, you'll understand after getting more skilled what can be looped instead and so on and so forth
y = 1
repeat
-- code here --
until y == 2
end