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

Factory Management?

Started by deletedededed, 17 November 2014 - 12:12 AM
deletedededed #1
Posted 17 November 2014 - 01:12 AM
Hey everyone, I'm here on the CC forums today for a bit of help with management of my factory on a tekkit multiplayer server.

I'm trying to Program a computer to allow me to order items to a chest besides itself. However theres a catch, all of the items will be ordered using a computer. my plan is to run a command that is then transmitted through bundled cable to Supply chests. Depending on what is ordered, it will withdraw from the chests using Filters/Transposers (RP2) connected to different colored cable attached to the system of Bundled cable.
Heres the other catch, all items in the chests will be raw materials. Some items when ordered will have to be created through a series of Crafting table mk2's. (Buildcraft)

In simpler terms, I'm looking for a way to order my machines to make items then send them up through a system of pipes to myself in the simplest way possible using computer program with the presets. Does anyone have ideas that could make this less tedious seeing that I am not very fluent in lua.

If I can't a way to setup this order system, is there any simple way to run a command that will activate/de-active a pulse through the bundled cable so I can simply turn on/off the pulse (per wire) as enough of the item is sent into the machine system?
Bomb Bloke #2
Posted 17 November 2014 - 04:03 AM
So basically, you want a system which displays a list of menu items, and activates certain colours in a bundled cable according to what the user selects?

Something like this?
deletedededed #3
Posted 20 November 2014 - 12:53 AM
Exactly what I was looking for, Thanks a ton :D/>

Here's the code for people who don't like outside links.
Codelocal cableSide = "right" – Or where ever your cable is.

local mon = peripheral.wrap("left") – Or where ever your colour monitor is.
mon.setTextColor(colours.white)
mon.setBackgroundColor(colours.black)
mon.clear()

local xLen, yLen = mon.getSize()

local myEvent

– Menu items.
– Add as desired, but don't exceed 16 entries.
local switches = {
["Block Smasher"] = {colour = colours.white, screenRow = 1},
["Atom Splitter"] = {colour = colours.red, screenRow = 5},
["Nuke Factory"] = {colour = colours.yellow, screenRow = 10}}

– Initial menu render:
for key,value in pairs(switches) do
mon.setBackgroundColor(colours.black)
mon.setCursorPos(2,value.screenRow)
mon.write(key)
mon.setCursorPos(xLen-5,value.screenRow)

if colours.test(rs.getBundledOutput(cableSide),value.colour) then
mon.setBackgroundColor(colours.green)
mon.write(" On ")
else
mon.setBackgroundColor(colours.red)
mon.write(" Off ")
end
end

– Main program loop.
while true do
myEvent = {os.pullEvent("monitor_touch")}

for key,value in pairs(switches) do if myEvent[4] == value.screenRow then
mon.setCursorPos(xLen-5,value.screenRow)

if not colours.test(rs.getBundledOutput(cableSide),value.colour) then
mon.setBackgroundColor(colours.green)
mon.write(" On ")
rs.setBundledOutput(cableSide,colours.combine(rs.getBundledOutput(cableSide),value.colour))
else
mon.setBackgroundColor(colours.red)
mon.write(" Off ")
rs.setBundledOutput(cableSide,colours.subtract(rs.getBundledOutput(cableSide),value.colour))
end

break
end end
end
ZagKalidor #4
Posted 21 November 2014 - 07:08 PM
I do it with a huge openperipheral network with wired modems. I don't think that you will be able to handle the huge amount of different items (approx 2000 with my mods) with just 16 different colors. I use the slot handling methods to push the items into a tesseract and receive them instantly. Then i direct them into a crafting turtle. Its one input pipesystem for items coming from a quarry, routed by bc diamondpipes, one computer, one crafting turtle, and several processing lines for machineblocks that process items, ending up in "for now" 200 deep storage units. But its a young project. More to come…
Edited on 21 November 2014 - 06:32 PM
Bomb Bloke #5
Posted 22 November 2014 - 04:17 AM
I don't think that you will be able to handle the huge amount of different items (approx 2000 with my mods) with just 16 different colors.

Depends how you do it - 16 colours allows 65,536 different combinations.
deletedededed #6
Posted 24 November 2014 - 02:22 AM
In tekkit (What I'm using), there is colored Bundled cables from redpower2. Is there any way that I can use these in my programs because they seem to not be supported from what research I've done.

I don't think that you will be able to handle the huge amount of different items (approx 2000 with my mods) with just 16 different colors.

Depends how you do it - 16 colours allows 65,536 different combinations.

How did you get this calculation? Send us some of your "Work"
KingofGamesYami #7
Posted 24 November 2014 - 03:36 AM
I'm not sure where bomb bloke gets those numbers. Here's some I came up with through.

6 sides * 16 colors = 96 (this is the number of individual lines available. one per machine.)

2 ^ 96 = 7.9228163e+28 (number of possible combinations with 96 0's and 1's (on/off, true/false, whatever))
Dragon53535 #8
Posted 24 November 2014 - 03:55 AM
For each setup of colors there's different possibilities of the colors on and off on one side. Which if viewed as a shifting binary sequence allows you to see that out of the 16 colors, you have some on and some off.

0000000000000001 Would be one possibility
0000000000000010 would be the next and so on.
So with that math, 2^16th is 65536 which is bomb blokes number. This is for ONE side.
Adding it to 6 sides is the way that Yami did.
Edited on 24 November 2014 - 02:57 AM
Bomb Bloke #9
Posted 24 November 2014 - 04:37 AM
kenny, take a look at the colours API docs. Notice how each colour is represented by a number? By enabling different colours at the same time, all you're really doing is adding different numbers together. Every colour available to you multiplies your possible range of combinations by two.

The trick to taking full advantage of this fact hinges on your ability to have the machines at the other end read your signals. It's one thing to check if a certain colour is active, it's quite another to check if three colours are active while also making sure the other thirteen are not! You'd need quite a few logic gates set up, I'd assume - I haven't played with RP2's filters/transposers/etc.

Using computers as gates is fairly simple. For every, say, fifteen machines, you connect one computer up to your bundled cable. Each computer looks for a certain combination of the first twelve possible colours - if it sees that combination activate on the cable, then it takes the number represented by the remaining four colours, and activates whichever machine it's connected to that corresponds to that number. This'd theoretically let you connect up to about four thousand "gate" computers, which, if they have fifteen machines each, is well over 60,000 machines.

Wrap your head around that and you're partway to understanding TCP/IP-based subnetting. ;)/>

It is worth pointing out again that modems could potentially make this process easier, if only because you wouldn't need as many cables. The actual coding difficulty would be about the same, I'd say.
Edited on 24 November 2014 - 03:39 AM
ZagKalidor #10
Posted 24 November 2014 - 09:30 AM
Just think of how many recipes use the ingredient lets say "redstone". My first factory failed with getting the ingredients to the many bc benches, crafting different items. Using a simple chest would give you one input side and five output sides for the content. This will manage to lead the ingredient into 5 different crafting benches. You will need more chests with the same content. Think of the space/room it will take to manage crafting with one "high running" ingredient without having the pipes connecting to each other. Maybe you could rout them with iron pipes and gates to different locations but every iron pipe would need a signal for routing. Now think of the benches and how many pipes lead into it to feed the recipes for crafting. OK, room/space doesn't matter, because there are lots of it.

Also think of the fact, having hundreds of computers, setting your gates at every single chest, improving your code in maybe a single line would be a very special task!

Of course you will be able to craft your "most used" items with this way. But going into one crafting device will manage to craft all craftable items. Think of the amount of pipeways you will have, having 20 benches, i think you will not be able to fathom it after a week or more. it will be a big confusing spiderweb of pipes leading into confusing somewhere "eem, where did this one go?" OK, you will name them with signs. As i said, i did it the same way 2 years ago and very quickly abandoned that.

Ok, you will be able to use approx. 66000 different color combinations on a bundled color logic. And as King said, on another 4 sides of the computer. This will be the next confusing challenge. "Did i use this color or that color, which one is free on which side?" Tthere are quite a lot of ways to do the code for that, but if bomb-bloke and lyquid are not your neighbours, its quite a extensive project. It will take a database for every item with the right colorcombination of the bundled-logic, depending on what side of the computer you will give off your signal. Of course this is no hard task to do. The hard part is to manage the hundreds of colors.

OK, maybe i'm overacting things a little, but i think you will take a lot of time on classifying your colors and pipeways and browse your color-documentation.

Its not my intend to override your idea, im just trying to help and give tips and hints. Maybe it will work for you, do what you like.I'm just giving you my experience with that idea, because i tried the same way, just without the bundled cables. But think of the advantage to not give the demanded item the given pipe-way. Instead you could lead it to every place you want with just one "Push". It could be crafting, machineblock-processing, feeding Plants or farms, anything you want it to be. All you need is to put up the "Open Peripheral Code", for sending items into different scheduled "treating targets", a similar way as you would do now. A Tesseract does that quite well. Giving him channels for different locations will do the job quite good. Receive any item and then send it to what you like. Another advantage of this idea is: The item is received at it's destination when you push the button, no matter how far away it is stored. There are no waiting times for traveling through long pipe-ways.

It's only one little difference to your idea: For crafting it will be, "send any item to one crafing device", not sending lots of items to lots of different crafting devices.

Everyone can do things as he wants to do. Having fun matters…
Edited on 24 November 2014 - 10:43 AM