Posted 31 May 2013 - 01:56 PM
hello i´m new to this Forum and i´m not so good in writing English but i hope u can Understand me.
I was writing a turtle program and it seems to work but there is one bug that i cant find
The program should build a farm terrain for an automatic farm
here is my code
when i was using it it build the first layer and go down to build the second but then it stops and i can´t find the problem please help me
I was writing a turtle program and it seems to work but there is one bug that i cant find
The program should build a farm terrain for an automatic farm
here is my code
shell.run("clear")
local Num1,Num2,Num3,Num4,Num6,Num7 = 1,2,3,4,5,6,7
print("Herzlich Willkommen zum Felder Generator\n")
print("Wie viele Felder sollen nebeneinander gebaut werden?:")
local felder = read()
term.setCursorPos(1,7)
print("Wie viele Felderreihen sollen gebaut werden?:")
local reihen = read()
term.setCursorPos(1,9)
print("Berechne Erde\n")
erde = ((felder*7)*6)*reihen
print("Es werden ")
print (erde)
print(" Erd Blöcke gebraucht das sind ")
erde = erde/64
print (erde)
print("Stacks\n")
print ("Bitte fülle den Turtle mit Kohle und Erde.\n")
print ("Kohle auf Platz eins und erde auf 2-16.\n")
print("Wenn alles aufgefüllt ist Tippe Y zum Start ein:")
input = read()
if input == "Y" then
turtle.select(1)
turtle.refuel()
turtle.select(2)
selecteditemslot = 2
itemcount = turtle.getItemCount(selecteditemslot)
b=Num7
c=7
d = (reihen*1)
while d>0 do
while c >0 do
a = (felder*6) + felder
while a >0 do
turtle.forward()
a=a-1
if turtle.detectDown() then
turtle.digDown()
end
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
end
if b==Num7 then
b=Num6
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
elseif b==Num6 then
b=Num5
turtle.turnRight()
turtle.forward()
turtle.turnRight()
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
elseif b==Num5 then
b=Num4
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
elseif b==Num4 then
b=Num3
turtle.turnRight()
turtle.forward()
turtle.turnRight()
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
elseif b==Num3 then
b=Num2
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
elseif b==Num2 then
b=Num1
turtle.turnRight()
turtle.forward()
turtle.turnRight()
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
elseif b==Num1 then
b=Num7
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.down()
e=(felder*6) + felder
while e>0 do
turtle.forward()
e=e-1
end
turtle.turnLeft()
turtle.turnLeft()
if itemcount > 0 then
turtle.placeDown()
itemcount = itemcount-1
else
selecteditemslot=selecteditemslot+1
turtle.select(selecteditemslot)
itemcount = turtle.getItemCount(selecteditemslot)
turtle.placeDown()
itemcount = itemcount-1
end
else
print("neues feld")
end
c=c-1
end
end
c=7
d=d-1
end
when i was using it it build the first layer and go down to build the second but then it stops and i can´t find the problem please help me