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

turtle.suck true?

Started by goldensecret, 13 April 2014 - 10:01 PM
goldensecret #1
Posted 14 April 2014 - 12:01 AM
yo, so i have this code, and i want the turtle to check if it can pull from a inventory in front of it, if it can, then sleep 2 seconds, check again, then if it can then take from the inventory and put it in the chest above it.

this is supposed to be a de-clogger for the router from FTB.

heres the code:


if turtle.suck() == true then
print ("can pull, waiting")
sleep (2)
if turtle.suck() == true then
turtle.pull()
os.reboot()
end
end
if turtle.suck() == false then
print ("why do you want me here?")
os.reboot()
end

the problem is that its pulling from it. and not checking if it can. if there are problems beyond that i do not know. as i havent got that far yet.

TL;DR
how do i make a turtle return true if it can do something. and not just do it, then return true.
CometWolf #2
Posted 14 April 2014 - 12:08 AM
It dosen't work like that im afraid. The true/false from most turtle actions are simply the result of said action, there's no way of checking it without performing it. However, why does it even matter, since you're pulling the item anyways?

Also, don't say from FTB. FTB is not a mod >.>
Edited on 13 April 2014 - 10:08 PM
goldensecret #3
Posted 14 April 2014 - 12:18 AM
ok, so heres the situation, the router from Factorization gets clogged with my system when it is sorting my barrels, clogging the 1 inventory space it has to use, and blocking my whole system, what i wanted was a turtle to check if somthing is in there. sleep 2 seconds, and if it is still in there, take it out, and drop it into the tesseract (above) that leads to a misc chest that i can go through later.
CometWolf #4
Posted 14 April 2014 - 12:28 AM
There's probably some openP method to get the contents of the routers inventory. Alternativly, a BC gate might also be able to check it's inventory.