Reece C. Posted September 23, 2013 Posted September 23, 2013 I have a factory, or what I call a facility, because there is no real assembly line for one particular product. But that's besides the point. In my facility I have allot of things going on. And I have one particular room with a crap load of levers to activate/deactivate certain functions of the facility. Such as power production, processing, storage etc... But most of the time its hard to tell at a glance what is and isn't running, or what is happening without running through the entire place and right clicking on machines. So I want to have a monitor that will display statistics on my facility. I was thinking of going about this by having a computer at each department in the facility. (I set up each department to emit red-stone signals depending on there status. EG. when power is being produced, it emits a red-stone signal.) What I want to do is have a computer at each department, and when it detects a red stone signal, to send a command to the main computer (The one attached to the monitor) to display a specific thing on the monitor. I am new to computer craft, and only know the most basic and primordial commands. So in short I can't do anything in computer craft on my own yet. Note: I do not want to control the facility by computers, I just want to use the computers to tell me what is going on. I much rather pull levers than put in commands, there is a certain satisfaction with pulling levers. :/ So, is this possible? And if it is, how do I go about doing it? Thanks for any help you can provide. Quote
Norman1346 Posted September 23, 2013 Posted September 23, 2013 I don't know about displaying on a monitor but I use red-stone torches to know when certain things are running.You know what is happening by which red-stone torches are on or off. You can even put a sign below each torch so they are labeled. I enjoy wiring red-stone myself and am not very interested in Comp craft or the red-net controller. Quote
Reece C. Posted September 23, 2013 Author Posted September 23, 2013 I don't know about displaying on a monitor but I use red-stone torches to know when certain things are running.You know what is happening by which red-stone torches are on or off. You can even put a sign below each torch so they are labeled. I enjoy wiring red-stone myself and am not very interested in Comp craft or the red-net controller. That's not the point. If I wanted to use the conventional "red-stone torch way" I wouldn't be posting this thread. Quote
Reece C. Posted September 23, 2013 Author Posted September 23, 2013 Ok, so I have done more reserch and what I h ave so far is how to detect a red stone signal. I would wright something like this while true do shell.run("clear") if rs.getInput("side") then print("redstone ON") else print("redstone OFF") end os.pullEvent("redstone") end But this is for a computer attatched to that process in the facility. So instead of printing the text itself, it has to tell the main computer (the one with the monitor) to print that text onto the monitor. To give you an Idea, the monitor might look something like this ----------------------------------------------------------------------- --------------------------Facility Stats------------------------------- ----------------------------------------------------------------------- Generators: ON Ore Processing: Inactive Power Buffer: Retain Auto Export: OFF ---------------------------------------------------------------------- These are some of the stats of my facility. I hope I am making sense. Quote
Viktor_Berg Posted September 23, 2013 Posted September 23, 2013 What you can do is have local computers for every part of the facility. Each computer can handle up to 96 combined signals (input/output), 16 from each side of the block if using MFR RedNet cables. If you attach a wired or a wireless modem to one side, you can connect this computer with another one, centralized wherever your control room is. All this is rather easy to set up once you have your basic logistics laid out. The hardest part would probably be setting up all the modems to transmit proper signals for all the events. Then again, if you use os.pullEvent on the master computer, it can monitor every other peripheral computer out there. You can even use an Advanced Computer + Advanced Monitor for some fancy colored text! As for the program itself, it's kinda hard to help you out with direct code without knowing exactly the specifics of your facility. Quote
Reece C. Posted September 23, 2013 Author Posted September 23, 2013 As for the program itself, it's kinda hard to help you out with direct code without knowing exactly the specifics of your facility. I understand. At this point what I need to know is how to have multiple local computers send commands to one main computer, Just to narrow it down. If I can just figure out how to make one computer make another computer do something, I can figure out the rest on my own. Quote
Viktor_Berg Posted September 23, 2013 Posted September 23, 2013 I understand. At this point what I need to know is how to have multiple local computers send commands to one main computer, Just to narrow it down. If I can just figure out how to make one computer make another computer do something, I can figure out the rest on my own. Events are your answer. Basically, you can make a computer "listen" for certain events, such as a redstone trigger, or maybe a wireless message coming in, or (on advanced monitors and computers), someone using a touchscreen. While the computer is waiting for an event, its program is basically frozen. This, of course, presents a challenge in that a computer can hardly be used for both monitoring and control UNLESS the program is written in such a way as to facilitate fast updates on the system. Thankfully, there is a way to do this. In essence, all user inputs to the computer (such as typing something on the screen, pressing a key, pressing a button or using the touch screen) are ALSO events. What this means is that the "master" computer can be programmed to listen to all kinds of events indiscriminately, and then act on those events. I am not entirely sure if bundled cable triggers are unique events, though, so for this purpose, I'd suggest using touch screens for user input. Touch screens in CC are a whole different thing, and I'd suggest you watch tutorials on how to make them work. However, when all is done, the basic idea is that your computer "sleeps" until it either receives a button press from you as the user, OR a rednet message from another computer, and then acts on that event. Like I said, the specifics of coding are unique for how you want your system to be laid out, but it's very possible to learn it up. I never did programming courses, but I learned LUA programming more or less myself. You should also be able to do that. Also, use the wiki. http://computercraft.info/wiki/Os.pullEvent Quote
Reece C. Posted September 23, 2013 Author Posted September 23, 2013 I won't be using the computer to give commands, just to display stats given to it from other computers around the facility. It will two different types of trigger words or numbers from each computer around the facility. Basically each computer is connected to red-stone, when it receives a red-stone signal, it sends a number or word to the main computer, that would trigger something, in this case it would trigger the computer to display something on the monitor, and when the other computer is not receiving a rs signal it will send a different word or number that would trigger the display. Quote
dwwojcik Posted September 23, 2013 Posted September 23, 2013 The easiest way I can think of to do what you want is MFR RedNet cabling. Theoretically speaking, all you'd have to do is tell each computer to control a specific color channel, and the monitor computer would know which color corresponds to each function. In the latest Tekkit there's a RP2 Bundled Cable like API for the RedNet. Quote
Reece C. Posted September 23, 2013 Author Posted September 23, 2013 So what I have is a wireless red-net set up. the problem now is getting my main computer to tell the diference between all the other computers. I am using the "rednet.recieve". What I had was this id, EngStatus = rednet.receive() but then I had a bunch of other ones for each computer, so I had to identify them. I replaced the "id" at the beginning with the id of the computer sending the message. but when I start the program I get "bios:337: [string "startup"]: 3 : unexpected symbol" Isn't that supposed to be the sender id? Quote
dwwojcik Posted September 23, 2013 Posted September 23, 2013 I don't know, I'd have to look into it. I'd like to clarify the difference between the MFR cables and the ComputerCraft wireless network. Both are called RedNet, but in my post I was referring to the former. Quote
Reece C. Posted September 24, 2013 Author Posted September 24, 2013 I was just about to go way off topic, because I have new questions now. So if an admin wishes to close this thread, go ahead, I am posting a new one with a different question and better detail on my current set up. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.