2 posts
Location
Gainesville, FL
Posted 09 March 2013 - 05:18 PM
I'm creating an elevator system that utilizes railcraft elevator rails, advanced touchscreen monitors, and rednet.
I've gotten the program to build the buttons on the screen, and respond to touches properly, however when the buttons are touched no rednet signal seems to be getting received by other computers in the network.
my code is found here:
http://pastebin.com/Cf1RHyZnThanks in advance!
8543 posts
Posted 09 March 2013 - 05:51 PM
Split into new topic.
1522 posts
Location
The Netherlands
Posted 09 March 2013 - 11:28 PM
You might want to use:
local event = { os.pullEvent() }
-- Os.pullEvent() has an order of variables, this is always the same.
if event[1] == "rednet_message" then
-- your Code
elseif event[1] == "monitor_touch" then
-- your code
end
You can see what kinds of variables it uses on this page:
http://computercraft...ki/Os.pullEventActually the parameters arent quite right, the first parameter is always what event..
Your code wont work because it will only send when you send it yourself. Unless you are trying to send yourself a rednet message wich seems useless :P/>
I think you should use:
elseif floorID[y] then
This will check if floorID[y] is valid, otherwise it wont send. And floorID[y] = tostring(compID) then, should never hit unless the ID is defined in the table itself
Hope I helped,
Egineer
Edit: Nvm, your a broadcasting if you hi your own ID.. hmm I am also wondering now…
Edited on 09 March 2013 - 10:40 PM
2 posts
Location
Gainesville, FL
Posted 10 March 2013 - 12:16 AM
I think the real problem area is in the reception of rednet messages because even the rednet.send() isn't being heard on the other end. It seems as though the message is getting sent from the input computer, but never gets read by the second comp.
645 posts
Location
'Merica
Posted 10 March 2013 - 08:53 PM
The problem is you never told the program to receive a message, you only told it to broadcast one, do
id, msg = rednet.receive()
-- You don't need to do this exacly
print(..id": Is sending a message: "..msg)
then just pull the event in order to allow it to send multiple messages without needing to receive them first, or you'll have your screen frozen until it gets a rednet message. Hope I helped.
997 posts
Location
Wellington, New Zealand
Posted 10 March 2013 - 09:43 PM
The problem is you never told the program to receive a message, you only told it to broadcast one, do
id, msg = rednet.receive()
-- You don't need to do this exacly
print(..id": Is sending a message: "..msg)
then just pull the event in order to allow it to send multiple messages without needing to receive them first, or you'll have your screen frozen until it gets a rednet message. Hope I helped.
Um, he does receive rednet messages. With os.pullEvent.
If a computer broadcasts a message, does it receive the message it just sent?
645 posts
Location
'Merica
Posted 10 March 2013 - 09:58 PM
@immibis (I was too lazy to quote, plus something is bugged about my qoute option)
Well in CC Emulator when I use os.pullEvent to receive a message, yes it does just receive the message you sent, and I think same with reg CC.