Posted 30 June 2014 - 02:20 PM
hello all. i am working on a small planter program to use with pnumaticraft seeds for the squid seeds as it works a little better than the other planters i have seen but i am trying to control a turtle wirelessly but am having a bit of trouble after having it check fuel and refuel it opens communication than just sits and does nothing i know it is in range as i have done basic lua console to test if it will recieve the message. i just need a little help with my code which is as fallows
os.loadAPI("rom/apis/rednet")
while true do
com = rednet.isOpen()
if com == false then
rednet.open("left")
else
if com == true then
print("communication open")
turtle.select(2)
fuel = turtle.getItemCount(2)
level = turtle.getFuelLevel()
if fuel < 64 then
if level < 20000 then
turtle.suckDown(64-fuel)
turtle.refuel()
else
if level < 20000 then
turtle.refuel()
else
sleep(1)
id, message = rednet.recieve()
if id == "20" and message == "plant" then
print("message recieved")
turtle.select(1)
slot = turtle.getSelectedSlot()
number = turtle.getItemCount(slot)
if number == 8 then
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.forward()
turtle.dropDown(1)
sleep(15)
turtle.turnRight()
turtle.turnRight()
turtle.forward()
sleep(1)
turtle.forward()
sleep(1)
turtle.forward()
sleep(1)
turtle.forward()
sleep(1)
turtle.forward()
sleep(1)
turtle.forward()
sleep(1)
turtle.forward()
sleep(1)
turtle.forward()
sleep(1)
turtle.turnRight()
turtle.turnRight()
else
end
end
end
end
end
end
end
end
if anyone can help i would appreciate it