[attachment=1279:2013-07-31_02.16.16.jpg]
1. Receiver The computer in the bottom left hand corner of the screen shot. The receiver is supposed to carry out the actions the senders tell the receiver to do as well as say what part of the code it is working on and what how many cycles it has completed.
--FUNCTIONS
function PRDR(a)
if message == "*-|" then
d = colors.combine( colors.orange, colors.magenta)
f = colors.subtract(f, colors.white)
rs.setBundledOutput("bottom", d, f)
elseif message == "-*|" then
d = colors.subtract(d, colors.orange, colors.magenta)
f = colors.combine(f, colors.white)
rs.setBundledOutput("bottom", d, f)
end
if a == 1 then
d = 1 + d
end
end
function MLC()
PRDR()
coroutine.yeild()
PRDR(1)
end
--CODE
CrCmd = coroutine.create(MLC)
rednet.open("back")
d = 1
while true do
term.clear()
term.setCursorPos(1,1)
print("Phase - 1")
message = rednet.receive()
coroutine.resume(CrCmd)
sleep(1)
print("Phase - 2")
message = rednet.receive()
coroutine.resume(CrCmd)
sleep(1)
print("Cycle - "..d)
end
2.Sender_1 Then computer on the upper left hand side of the screenshot is Sender 1. Sender 1 is responsible for providing a password GUI to users so that one may not just walk into my friend and I's house. The password system is set to be flexible so that new passwords can easily be added later. Sender 1 is also supposed to multi- task almost all the time,(this bit I can't figure out) When the password program is running sender 1 is also supposed to monitor for interaction with sender two incase someone is coming out and needs to leave. when sender 2 sends it's message to the receiver it also sends a message to sender 1. telling Sender 1 that it needs to stop waiting for someone to press a key and enter in a password and instead to print ("PRESS ENTER TO CLOSE") on the screen and wait for someone to press the 'ENTER' key then tell the receiver to close the door. When sender 1 tells the receiver to open the door it sends a message to Sender 2 telling it that the user is on its way and it has to load the close door option and do nothing else until the door has been closed, then Sender 1 resets and waits again for the user or sender 2 to tell it its in charge of closing the door.
[code]term.clear()
term.setCursorPos(1,1)
rednet.open("back")
write ("Password: ")
input = read("*")
a = "."
d = 0
while true do
term.setCursorPos(1,2)
print("analyzing"..a.. ..b.. ..c) -- causes error and i can't get the code to add a period on every time an second elapses for 3 consecutive seconds
sleep(1)
a = a + "."
if d == 3 then
break
end
d = 1 + d
end
if input == "25434673" then
rednet.send(0, "*-|")
rednet.send(2, "open")
term.setCursorPos(1,2)
print("Welcome, Jordan!")
elseif input == "cantley" then
rednet.send(0, "*-|")
rednet.send(2, "open")
term.setCursorPos(1,2)
print("Welcome, Adam!")
end
3.Sender 2 The computer near the middle of the screen in the far back is Sender 2. Sender 2 has the same description as Sender 1 except Sender two waits for sender 1 or the user to press enter twice because your inside and there is no need for a password anymore.
-- no code for Sender 2
-- I can't write Sender 2's code because I'm stuck and have simulated everything on other CC computers on another world and just can't seem to figure out how to make S1 and S2 work together as described in Sender 1's description.
-- I also can't figure out the issue with the while loop for the 'analyzing' loop simulating a loading delay for reading and checking the password. It don't want to add an extra period after each loop until d reaches 3.
Please help I don't know what to do anymore. I'm seriously stumped and can't figure out anything that seems to work to my specifications. My friend and I would greatly appreciate it.
Thank You, and Happy Coding
P.S. - We are using CC for minecraft 1.4.7, couldn't find a redpower release for MC version 1.5.1 so never bumped it up a notch.