Posted 23 April 2014 - 01:40 PM
I have a program called "Check" because in a single player world I'm practicing with lua so I have a house controlled with computers and stuff and this is a program for checking if needed computers are online, for some reason it breaks the loop and ends the code but I don't have a break in it.
EDIT: fixed a couple spelling errors. I can never spell receive right. Now it just does the slow print "Checking systems…" and restarts from the beginning of the loop.
print("Green level system check.")
print("For higher level system checks please check")
print("from said levels.")
print("Type 'check' to check green level systems.")
while true do
local input = read()
if input == "check" then
textutils.slowPrint("Checking systems...")
rednet.broadcast("gdcheck")
local did, dmessage = rednet.recieve(5)
if not dmessage then
print("Error: Door offline.")
end
rednet.broadcast("glcheck")
local lid, lmessage = rednet.recieve(5)
if not lmessage then
print("Error: Light system offline.")
end
else
print("Type 'check' to check green level systems.")
print("Go to a higher level to check higher level")
print("systems.")
end
if dmessage == "gdgood" then
print("Green door online.")
end
if lmessage == "glgood" then
print("Green lights online.")
end
end
Note: It's probably worth noting I don't use rednet.open("side") because the computer this runs on uses the new bg function in startup to run multiple programs, one of which already opens a wireless modem on the back.EDIT: fixed a couple spelling errors. I can never spell receive right. Now it just does the slow print "Checking systems…" and restarts from the beginning of the loop.
Edited on 23 April 2014 - 12:56 PM