33 posts
Posted 06 August 2013 - 10:05 PM
I have a program that turns on and off my peat engines but I want to know how much peat is left in them so I know when to refill them. Is there any way to do this? I know you could do it with ccSensors but that hasn't updated past 1.2.5. Btw im on Yogcraft 1.4.7
331 posts
Posted 07 August 2013 - 02:12 AM
I have no idea what cc version that is but you could put a turtle under your peat engine doing
while true do turtle.select(1) turtle.suckUp() rednet.send(id, turtle.getItemCount(1) ) end
replace id with a computer id
997 posts
Location
Wellington, New Zealand
Posted 07 August 2013 - 05:13 AM
With CC by itself, there's no way to see how many items are in an inventory without pulling them out and putting them back in.
If that's fine, you can use turtle.suck on a turtle to suck the items out of the inventory, then turtle.getItemCount to
check how many items the turtle is holding, then turtle.drop to put them back.
33 posts
Posted 07 August 2013 - 11:58 PM
With CC by itself, there's no way to see how many items are in an inventory without pulling them out and putting them back in.
If that's fine, you can use turtle.suck on a turtle to suck the items out of the inventory, then turtle.getItemCount to
check how many items the turtle is holding, then turtle.drop to put them back.
Hey are you immibis from immibiscore and microblocks? And using a turtle would be fine, thanks!
33 posts
Posted 08 August 2013 - 12:13 AM
I have no idea what cc version that is but you could put a turtle under your peat engine doing
while true do turtle.select(1) turtle.suckUp() rednet.send(id, turtle.getItemCount(1) ) end
replace id with a computer id
Hmm, it just took out the ash and left the peat
162 posts
Posted 08 August 2013 - 01:10 AM
If it was me I would be having 8 slots with 1 peat in each of them and the remaining 8 with 1 ash each. This way you can pull down up ~7stacks of each and still be able to identify how much peat or ash you have. You would use the same code but replace "turtle.getItemCount(1)" with:
local nPeat = 0
function peat()
for x = 1,8 do
turtle.getItemCount(x)
nPeat = nPeat + (turtle.getItemCount(x)) - 1
end
print("There are "..nPeat.." many peat left")
end
You could do the same for ash. When you put your peat back in, just use:
local nSlot = turtle.getItemCount(1) - 1
turtle.place(nSlot)
so that you still have 1 peat left in the slot
33 posts
Posted 08 August 2013 - 02:13 AM
Actually, instead of having the turtle under the engine; which pulled out the ash, I put the turtle on the side and PRESTO. It sucked that peat right out and I turtle.drop() 'ped it back in the engine. It pulls the peat out every 250 seconds-how long it takes for 1 peat bar to burn (or 5000 ticks which last 1/20th of a second per tick. 5000/20=250) and re-sends the amount left to the master computer.