Posted 31 July 2013 - 09:46 PM
Okay so My receiver for my door mechanism has been acting up ever since I made it and now that I have written a new program for both of my Senders it doesn't even want to pretend that a message is there. NO MATTER WHAT THE MESSAGE IS! Like What The Heck! At first it was just not setting any value at all to my bundled cable beneath it so I started playing around with the code on the receiver. Then adjusting the code on my primary sender so that I can send a test message, to the receiver in hope that my receiver just had a bad line of code but instead after the ninth edit it doesn't want to do anything but the first two print commands inside the code. if someone thinks they can help me out then here's the code for the receiver, and the messages have to be flexible because both messages come from both of my Senders (1 - Primary) and (2 - Secondary). Both Senders are just as important it's just that one comes before the other.
--FUNCTIONS
function checkMessage()
if message == "OPEN" then
g = colors.combine( g, colors.orange, colors.magenta)
rs.setBundledOutput("bottom", g)
g = colors.subtract(g, colors.white)
rs.setBundledOutput("bottom", g)
print("open")
elseif message == "CLOSE" then
c = colors.subtract( c, colors.orange, colors.magenta)
rs.setBundledOutput( "bottom", c)
c = colors.combine( c, colors.white)
rs.setBundledOutput( "bottom", c)
print("close")
end
end
--CODE
rednet.open("back")
d = 1
while true do
term.clear()
term.setCursorPos(1,1)
print("Cycle - "..d)
print("Phase - 1")
message = rednet.receive()
checkMessage()
print("Phase - 2")
message = rednet.receive()
checkMessage()
print("Phase - 3")
d = d + 1
end
P.S. - I'm using CC 1.4.7