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

I need something like os.pullevent for the gate reader... ideas?

Started by Novakis, 15 April 2013 - 10:06 AM
Novakis #1
Posted 15 April 2013 - 12:06 PM
I want to use a gate reader to detect when a quarry is complete, which works great, but as it is now I use a sleep command and have the computer check every 10 seconds. Is there a better way to do this? Here is the code I have so far:

rednet.open("bottom")
local gate = peripheral.wrap("back")

while true do
   local data = gate.get()
   while not data["Work Done"] do
      sleep(10)
      data = gate.get()
   end
   rednet.send(55, "quarryDone")
end		  
Sariaz #2
Posted 15 April 2013 - 05:00 PM
I dont believe there is but if you might want to start a quarry that is really small and set computer with gate reader and just have it print all events and see if gate reader gives off any events.
superaxander #3
Posted 15 April 2013 - 07:50 PM
No there is no better way you could do that sorry :(/> you could try putting the delay down to the max of 0.05
Novakis #4
Posted 16 April 2013 - 04:47 PM
No there is no better way you could do that sorry :(/> you could try putting the delay down to the max of 0.05
I was hoping not to do that because of the possible lag to the server… oh well.
PixelToast #5
Posted 16 April 2013 - 04:52 PM
.-. it dosent lag that much
and why would you need to check that fast?
its a quarry, your supposed to let it run for a long time
Novakis #6
Posted 16 April 2013 - 05:35 PM
.-. it dosent lag that much
and why would you need to check that fast?
its a quarry, your supposed to let it run for a long time
I have a system that benefits from knowing when the quarry is finished as soon as possible.
Sariaz #7
Posted 16 April 2013 - 05:39 PM
Only way i can think of is when it stops spiting out items check to see if its done not perfect but would limit number of times checking
PixelToast #8
Posted 16 April 2013 - 05:46 PM
Only way i can think of is when it stops spiting out items check to see if its done not perfect but would limit number of times checking
less efficient than just reading pipe wire
theoriginalbit #9
Posted 16 April 2013 - 05:51 PM
less efficient than just reading pipe wire
Hmmm that just gave me an idea.
  • Quarry
  • Gate on pipe with hasWork conditional outputting to pipe wire
  • Pipe wire connect to redstone which connects to the computer
  • then computer has os.pullEvent('redstone')
Sariaz #10
Posted 16 April 2013 - 06:04 PM
Only way i can think of is when it stops spiting out items check to see if its done not perfect but would limit number of times checking
less efficient than just reading pipe wire

Ok i havnt used buildcraft in like 6 months so have no idea what pipe wire can do :P/>
theoriginalbit #11
Posted 16 April 2013 - 06:07 PM
Ok i havnt used buildcraft in like 6 months so have no idea what pipe wire can do :P/>
if you put a gate on a pipe next to the quarry, then run the pipe wire along all the pipe to the computer, then set the gate to hasWork output the pipe wire signal.
PixelToast #12
Posted 16 April 2013 - 06:34 PM
you put an AND/OR gate on the pipe connected to the computer (make sure it has the pipe wire)
then you right click the gate, then click the top left box until you see the setting you want
then click the top right one until you see the redstone torch

now use this code:

rednet.open("bottom")
while true do
   local p={os.pullEvent()}
   if p[1]=="redstone" and rs.getInput(side) then
	  rednet.send(55, "quarryDone")
   end
end
and put the side where gate is instead of side
this method requires no gate readers
Sariaz #13
Posted 16 April 2013 - 06:52 PM
Ok i havnt used buildcraft in like 6 months so have no idea what pipe wire can do :P/>
if you put a gate on a pipe next to the quarry, then run the pipe wire along all the pipe to the computer, then set the gate to hasWork output the pipe wire signal.
you put an AND/OR gate on the pipe connected to the computer (make sure it has the pipe wire)
then you right click the gate, then click the top left box until you see the setting you want
then click the top right one until you see the redstone torch

now use this code:

rednet.open("bottom")
while true do
   local p={os.pullEvent()}
   if p[1]=="redstone" and rs.getInput(side) then
	  rednet.send(55, "quarryDone")
   end
end
and put the side where gate is instead of side
this method requires no gate readers

If those posts are for my benefit no need if i start using bc ill watch direwolf tutorial (Epic dude of great knowledge) if not continue :P/>.
theoriginalbit #14
Posted 16 April 2013 - 06:56 PM
Epic dude of great knowledge
For everything except programming in Lua.

EDIT: Also don't expect to say you don't know how to do it and then not have people try and help you
Edited on 16 April 2013 - 04:57 PM
Sariaz #15
Posted 16 April 2013 - 07:53 PM
Yes but knowledgable about mods like bc, and i know thats why i told you that you didn't need to so you didn't take time trying to explain it when i wasn't really reading thoroughly.
Novakis #16
Posted 17 April 2013 - 02:51 PM
less efficient than just reading pipe wire
Hmmm that just gave me an idea.
  • Quarry
  • Gate on pipe with hasWork conditional outputting to pipe wire
  • Pipe wire connect to redstone which connects to the computer
  • then computer has os.pullEvent('redstone')

you put an AND/OR gate on the pipe connected to the computer (make sure it has the pipe wire)
then you right click the gate, then click the top left box until you see the setting you want
then click the top right one until you see the redstone torch

now use this code:

rednet.open("bottom")
while true do
   local p={os.pullEvent()}
   if p[1]=="redstone" and rs.getInput(side) then
	  rednet.send(55, "quarryDone")
   end
end
and put the side where gate is instead of side
this method requires no gate readers

My problem with the logic pipes is they become non-functional when they move on a frame, which is needed. The gate reader continues running after moving so it seems to be the only choice. There is just no way it interact with it except with the computer.