
Reece C.
Members-
Posts
42 -
Joined
-
Last visited
Everything posted by Reece C.
-
Isn't the id supposed to be the sender computer's id?
-
So in short I don't have to change anything about these codes. So here they are. I went over them, and I can't see anything wrong. It looks fine to me. But here they are, maybe you or someone can find the issue. Sender Code: (computer attached to engines) rednet.open("left") while true do shell.run("clear") if rs.getInput ("back") then rednet.send(21,"engines on") else rednet.send(21,"engines off") end os.pullEvent("redstone") end Receiver code: (main computer with monitor) rednet.open("top") local engine_state = false mon = peripheral.wrap("back") while true do id, message = os.pullEvent("rednet_message") if id == 17 then if message == "engines on" then engine_state = true elseif message == "engines off" then engine_state = false end end mon.clear() mon.setCursorPos(5,5) if engine_state == true then mon.write("Engines: On") else mon.write("Engines: Off") end end
-
In the "os.pullEvent" line, when I put the sender id# I get the "unknown symbol" error.
-
sorry, i'm a total noob, but what should I write for the event?
-
Ok, I will try that and see if it works with the code.
-
Does the same go for wireless modems? That is what I am using.
-
only a minor typo, you wrote "do while true" instead of "while true do." Also you forgot to add "rednet.open("side") at the top. I fixed those, and changed the message that the computer sends to correspond with the code. But all it prints on the screen is "Engines: Off" And it does not change. So either it could mean that it is not recognizing or getting the message from the other computer, or it is but something in the code is wrong. Here is a template for message code. Do we have to include event and distance? while true do event, senderId, message, distance = os.pullEvent("rednet_message") if senderId == 5 then print("Got a message from the boss saying: "..message) end end Also, at the top of the code you declared something "engine_state = false" I have this odd feeling there is supposed to be something more in that declaration. Just guessing. It might also be because the computer sending the message only sends it once, not continuously. If I removed the "shell.run("clear")" from the sender code would it work? BTW thanks for the code, now were getting somewhere. :P
-
I am using more than two. I have one computer at each process in my facility. Because you can only have so many red-stone signals into one computer.
-
The main computer does not "request" info, but waits for it to be sent by the other computers. When it is received it triggers an action. In this case, displaying either "Engines: ON" or "Engines: OFF"
-
Some of you may have read my previous post. I have a facility, with many functions. I wish to know what is going on. So I have computers posted at each process in the facility, and they tell the main computer what state that process is in. an example: Computer 1 (it is posted at power generation.) rednet.open("left") while true do shell.run("clear") if rs.getInput ("back") then rednet.send(21,"Engins: ON") else rednet.send(21,"Engins: OFF") end os.pullEvent("redstone") end And the main computer receives this and displays it on a monitor. rednet.open("top") while true do id,EngStatus = rednet.receive() mon = peripheral.wrap("back") mon.clear() mon.setCursorPos(5,5) mon.write(EngStatus) end Sorry no spoilers. But obviously I have a very large monitor, to show lots of statistics. But I am up agenst a road block. Because I can only display one thing at a time. When new info comes in it replaces what is already on the screen. Also, using the "setCursorPos" is universal, and not just for one piece of text. I need to be able to show many statistics, in different places on the monitor, that, of course, will be changing all the time. I have looked at menu tutorials, but that isn't what I needed. Can someone help me? And if you need more information about my facility to get a better idea of how to help, please let me know. Thanks. PS: If anyone has a code(s) for something like this, please feel free to post them here. It may be all I need, because I can use it as a sort of template, and elaborate on it.
-
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.
-
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?
-
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.
-
Thank you, this helps.
-
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.
-
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.
-
That's not the point. If I wanted to use the conventional "red-stone torch way" I wouldn't be posting this thread.
-
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.