Jump to content




[Solved] Can You See How Much Peat Is In A Peat Engine?


  • You cannot reply to this topic
6 replies to this topic

#1 CitricThunder

  • Members
  • 33 posts

Posted 06 August 2013 - 09: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

#2 jay5476

  • Members
  • 289 posts

Posted 07 August 2013 - 01: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

#3 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 07 August 2013 - 04: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.

#4 CitricThunder

  • Members
  • 33 posts

Posted 07 August 2013 - 10:58 PM

View Postimmibis, on 07 August 2013 - 04:13 AM, said:

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!

#5 CitricThunder

  • Members
  • 33 posts

Posted 07 August 2013 - 11:13 PM

View Postjay5476, on 07 August 2013 - 01:12 AM, said:

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

#6 campicus

  • Members
  • 164 posts

Posted 08 August 2013 - 12: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

#7 CitricThunder

  • Members
  • 33 posts

Posted 08 August 2013 - 01: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.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users