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

Computercraft/BuildCraft pipe program

Started by RockLegend2, 20 February 2013 - 11:32 AM
RockLegend2 #1
Posted 20 February 2013 - 12:32 PM
Hey, everybody.

I know BuildCraft may be slightly out of the comfort zone of some of you, but I figure someone can help me.

What I need is a program that can tell a pipe or some machine to take a user-specified amount of objects out of a chest. Inversely, a user can specify an amount to deposit, which the pipe will transport to the main storage chest. Either way, I need the program to disallow rebooting, termination, or shutdown while the program is in use. The program must lock the user out until enough objects reach the chest or the user.

Thanks to anyone that helps. This is for personal use, not server use, and I'm using Technic 1.2.5.

Thanks again.
cant_delete_account #2
Posted 20 February 2013 - 12:47 PM
You can't tell a pipe to take a specified amount of items out of a chest with ComputerCraft. It doesn't have BuildCraft compatibility and even Normal BuildCraft can't do that. Sorry.
RockLegend2 #3
Posted 20 February 2013 - 01:07 PM
Hmm… Then is there any way to tell a turtle through a modem from a computer to take a certain amount of something out of one chest and put it into another chest?
Doyle3694 #4
Posted 20 February 2013 - 01:18 PM
Just make the turtle wait for rednet messages and then make it loadstring() what it gets. Then you can send whatever command you want to run to the turtle
RockLegend2 #5
Posted 21 February 2013 - 03:28 AM
Alright. So assuming that there's a turtle in a small 1x1x1 space with chests on either side of him, what would the code look like?
Rsstn #6
Posted 21 February 2013 - 04:19 AM
If you had only one type of item per chest you could just use redstone pulses to power buildcraft engines for one 'pump' at a time. One 'pump' of the engine removes one item from the chest via a wooden pipe. Just repeat the pulse until the right number of that item have been removed. Using turtles might be more efficient, but it depends what is easiest for you.
FuuuAInfiniteLoop(F.A.I.L) #7
Posted 21 February 2013 - 04:41 AM
you can power the bildcraft motor the time that it takes to suck one item

You can use os.pullEvent = os.pullEventRaw() to disallow termination with ctrl+t

you cant disallow rebooting or shutdown
RockLegend2 #8
Posted 21 February 2013 - 03:50 PM
I guess not disabling rebooting or shutdown isn't a big deal, as it would only inconvenience the user.

However, I have to state that, as my signature says, I am new at this. I do not know what redstone "pulses" are. I only use redstone.setOutput. I have not used pulses or any kind of detection on peripherals. I have not even used modems for anything but a chat program created by another user.

I really don't wish to sound childish or simple, but I do need a specific explanation of these things before I implement them.

Thank you.
Rsstn #9
Posted 21 February 2013 - 10:51 PM
Function for a pulse:

function pulse(outputSide, nPulses)
local i = 1
while i <= nPulses do
i = i + 1
rs.setOutput(outputSide, true)
sleep(1)
rs.setOutput(outputSide, false)
sleep(1)
end

Then call the function like this to make 5 pules from the back side of the PC:
pulse("back", 5)

Untested, but should work.