Hello everyone, I have a problem with my crafty turtle. If this continues I will soon have no hair on my head anymore. I play FTB light on a server and built myself an automatic solar panel farm. The turtle should pull the items from the chest out of the chest above it. In the chest is gold which comes from an oven. This should be further processed with a miniumstone to iron and then spent down in a chest. A friend has written everything I know, but it does not work and now the friend is in the holidays and I can not reach him.
I have to:
1. Give the turtle a label
2. then "edit startup"
3. write
while true do
turtle.select(2)
turtle.suckUp()
turtle.craft()
if turtlegetItemCount(3)> 0 then
turtle.select(3)
turtle.dropDown()
end
if turtlegetItemCount(2) > 7 then
turtle.select(2)
turtle.dropDown()
end
4. save, exit and reboot
But I get the error message "bios: 338: [string" startup "]: 12:` end`
expected (to close `while` at line 1)
Can someone help me get my turtle to work before I run out of hair?
Regards Tim Strym and google Translate
As the message suggests, you just need to add another "end" at the end of your program. This is a little easier to see if you mark up each if/while block like so:
while true do
turtle.select(2)
turtle.suckUp()
turtle.craft()
if turtlegetItemCount(3)> 0 then
turtle.select(3)
turtle.dropDown()
end
if turtlegetItemCount(2) > 7 then
turtle.select(2)
turtle.dropDown()
end
end -- This one was missing
Thanks so much!
Two more things:
First, this last end complete my whole program and this other end`s only end my subprogram?
Second, do you know good information sources for learn Computercraft/Lua? It should not be writen in the "hardest" english.
if you are lucky you might find a version in your language: https://www.lua.org/docs.html
computercraft uses lua 5.1
My language ist available.
But my program has a Bug... After a certain time the error message appears.. turtle:18: Too long without yielding some idea how i can fix this?
Call os.pullevent in you loops
Where i need to edit os.pullevent?
try this
while true do
sleep(0.1) -- contains an os.pullEvent and won't stop your program is there are no events
turtle.select(2)
turtle.suckUp()
turtle.craft()
if turtlegetItemCount(3)> 0 then
turtle.select(3)
turtle.dropDown()
end
if turtlegetItemCount(2) > 7 then
turtle.select(2)
turtle.dropDown()
end
end
@Lupus590 That shouldn't be needed - (most) turtle calls will yield internally.
@timstrym Can you post your full/updated program? I'm assuming there's a little bit more than what was in the OP?
@timstrym Can you post your full/updated program? I'm assuming there's a little bit more than what was in the OP?
[/quote]
Sure, but i only change the "end"
while true do
turtle.select(2)
turtle.suckUp()
turtle.craft()
if turtlegetItemCount(3)> 0 then
turtle.select(3)
turtle.dropDown()
end
if turtlegetItemCount(2) > 7 then
turtle.select(2)
turtle.dropDown()
end
end
The gold comes irregularly. Depends on how much is produced.