Posted 03 June 2016 - 06:27 AM
I have a network of computers and I can get them talking and I can also get a loop going using redstone, however, I cannot get the loop to exit. It either runs loop continuously or only runs through one time.
----THIS IS TRANSMITTING COMPUTER-----
######Transmitter#####
rednet.open("back")
x = tmoflash
while x ~= "exit" do
term.clear()
term.setCursorPos(1,1)
print("#####################")
print(" ")
print(" Lamp Control ")
print(" ")
print(" 1 = on 2 = off ")
print(" exit to quit ")
print("#####################")
x = io.read()
if x == "1" then
rednet.send(861, "on")
end
if x == "2" then
rednet.send(861, "off")
end
end
----THIS IS RECEIVER COMPUTER-----
######Receiver#####
rednet.open("back")
x = "0"
id, message = rednet.receive(10)
if id == 855 and message == "on" then
repeat
rs.setOutput("left", true)
sleep(1)
rs.setOutput("left", false)
sleep(1)
until x == "2"
else
if id == 855 and message == "off" then
rs.setOutput("left", false)
end
end