Posted 20 April 2014 - 03:07 PM
Hey yall.
So first off. I'm fairly new to both computercraft and Lua.
Anyway i've managed to make an OS for touch monitors.
I've made a few programs for this touchOS
One of them being called "Lights" this program lets me control the light of my base using redstone (enderIO) from a computer.
So my mate made a base aswell, and wanted to be able to do the same, we made a control hub between our bases.
Where the "Master computer" is located.
So i installed my OS on both the master computer and my mates computer
What i wanted to do is have a "page" in my "Lights" program that would control the lights in his base.
Aswell as being able to control the lights in his base, from his computer.
I can (easily) think of a way to do this, but i've run into a wall.
The reason for this is: When i use either modem_message og rednet_message on his computer the OS stalls, since the modem is waiting to receive sometehing ie.
rednet.receive()
problem is if i use rednet.receive() It will wait till it's gotten a message from the "main" computer, making my os unuseable while waiting.
So my question is: Is there any way/code/command/api that makes it possible to to send commands through the network without the receiver having to wait and stall the rest of the code till it gets it's "reply"?
here is my code that i have inside the loop that runs the touch os.
has the code for if
I hope this is to too messy or ununderstandable if there is any way i can explain myself better, or if there's anything you need to help me. Please let me know.
Much appreciated.
-YoShI
So first off. I'm fairly new to both computercraft and Lua.
Anyway i've managed to make an OS for touch monitors.
I've made a few programs for this touchOS
One of them being called "Lights" this program lets me control the light of my base using redstone (enderIO) from a computer.
So my mate made a base aswell, and wanted to be able to do the same, we made a control hub between our bases.
Where the "Master computer" is located.
So i installed my OS on both the master computer and my mates computer
What i wanted to do is have a "page" in my "Lights" program that would control the lights in his base.
Aswell as being able to control the lights in his base, from his computer.
I can (easily) think of a way to do this, but i've run into a wall.
The reason for this is: When i use either modem_message og rednet_message on his computer the OS stalls, since the modem is waiting to receive sometehing ie.
rednet.receive()
problem is if i use rednet.receive() It will wait till it's gotten a message from the "main" computer, making my os unuseable while waiting.
So my question is: Is there any way/code/command/api that makes it possible to to send commands through the network without the receiver having to wait and stall the rest of the code till it gets it's "reply"?
here is my code that i have inside the loop that runs the touch os.
rednet.open("top")
id,message = rednet.receive()
if id == 0 then --0 is the Id of the main pc
if message == "mWorkroom" then
workroomLights = 1
programLights()
end
end
The programLightshas the code for if
workroomLights == 1
to redstone.setOutput("right", true)
and if workroomLights == 0
it will ofc. have the output set to false.I hope this is to too messy or ununderstandable if there is any way i can explain myself better, or if there's anything you need to help me. Please let me know.
Much appreciated.
-YoShI