ID:397426
 
Keywords: cable, join, list, pipe, powernet
(See the best response by DarkCampainger.)
First off all I don't ask for a libary or a game rip off.I seek the tutorial off an expericed DM coder who made something similar or knows how to make it.

For a month now I had this idea and tried to code it. But sadly I'm not enough expericed to work out something like this from a sketch.

I checked all libary that I could find and all similar posts.
What I find out alone and whit a little help is the following.

I need a datum to keep count for all connected part.
Then I need two proc one when the item is created and one when its deleted. Soo they leave out the missing part and try to work whit the left parts.If not possible then shutdown the system.
Like in autojoin libarys.Also need a proc that keeps checking whats connected in each system.
Soo somehow each item need a list then the next joined item of same type gets added to that list.

Again if somebody would have time to make a tutorial it would help me and I think a lot of people who looking for something similar or want something similiar.

Anyway sorry for my bad english.
Horrid English aside, what exactly are you wanting to do? You're title is extremely vague and the description you gave only made it more confusing. I don't believe that you need expertise in the language to tell me what you want and why.
Here I made an illustration what I want to make.I hope this is less confusing than my writting.
I'm looking for a tutorial how to make ingame virtual wired systems.

-The reactor would produce energy.
-The energy is stored and transfered from the transformator.
-And all other device that connected to it gets energy.And they can share information in the system.

PowerNet Illustration
I think this post by forum_account may be valuable to you.

Using regions as he did there, you could connect not only buttons to doors, but power sources to buttons and then to doors, or however you would want to do it.
In response to Keevanar
So if what I'm getting is correct, you want a system where information and data is manually sent and received. If this is true, then do you expect player interaction with these various hubs? Eg. Players can cut wires, shut down transformers, ect. This is all relevant to making this system work both effectively and efficiently. If you don't expect player interaction, then this process of information sending would be the most inefficient machine procedure that I've ever seen. So much overhead that it wouldn't be funny.
I did something like this ages ago for a game I never finished. Trying to have the wires function all the time is nigh on impossible to do efficiently(I could only get a small room of a few objects to run constantly at a decent update speed without lag), but you don't need to.

I basically had the wires make sure things were connected every couple of seconds, then stored the energy consumption/data transfer rates in the consumers and generators themselves. Things worked pretty smoothly and it had a good bit of interactivity, but I never had the chance to really test it out under real conditions.
You need a data structure called a graph. The idea of a graph is that you have a set of vertices and a set of edges that connect two vertices. The wires and electronic devices are your vertices and it's pretty clear that an edge exists between two vertices if they are connected. Once you've got a graph data structure all you need to do is determine if their is a path from the power-consuming object to a power-generating object via your choice of graph searching method. If such a path exists then the machine is powered. Otherwise the machine is not powered.
I'm working on an update to the Region library that'll add some features to help with this. Currently, you can use it to find out if one object is connected to an instance of a certain type.

It's not really designed for this so it'll need some changes. It doesn't support all the kinds of searches you need to do. It also doesn't provide a way to represent the wire graphically.
In response to Robertbanks2
Best response
Robertbanks2 wrote:
... I basically had the wires make sure things were connected every couple of seconds ...

You can speed up the process significantly by only updating the system when a wire/component is added/removed. Even more so if you consider the locality of the change and what limited sections of the system it could affect.
In response to DarkCampainger
Well, I tried that a few ways and it either lagged horribly on larger, more intricate setups, or it was unreasonably slow to respond to changes in a network. Not to say that it can't be done, just that I couldn't find a nice balance at the time.

I imagine if you made it set up nodes in the wire every so often, you could more easily check things at the time of the change by just checking the connection between the nodes and informing any dependent users that the connection has been made/broken. There is, no doubt, some intelligent way of handling this well, but I'm too burned out to come up with anything good, so I'll leave it to you guys.
I just updated the Region library to include an example of this. You can read more about it here.

It's still very basic. The library lets you search for connected objects but, depending on the application, you might want to keep track of which objects are connected by wire. This is certainly possible to add, but I wouldn't add it as the default behavior - keeping track of the connected components is a lot of extra work which you might not even use. Still, it's something I plan to add in the future as either part of the library or a demo that's included with it. It could just be a sub-type of region, that way you can create a sub-type of /region if you don't want that extra behavior.
I would like to thank everybody for the information and help. And Forum_account thank you.Your libarys helped me a lot.