rednet.open("top")
local instruct = [[
Commands:
oil-on: Turns On Oil
oil-off: Turns Off Oil
water-on: Turns On Water
water-off: Turns Off water
all-on: Turns All on
all-off: Turns All Off
]]
print(instruct)
while true do
local inp = read()
if inp == "oil-on" then
rednet.broadcast("oil")
os.sleep(1)
rednet.broadcast("1")
print("Oil On.")
elseif inp == "oil-off" then
rednet.broadcast("oil")
os.sleep(1)
rednet.broadcast("2")
print("Oil Off.")
elseif inp == "water-on" then
rednet.broadcast("water")
os.sleep(1)
rednet.broadcast("1")
print("Water On.")
elseif inp == "water-off" then
rednet.broadcast("water")
os.sleep(1)
rednet.broadcast("2")
print("Water Off.")
elseif inp == "all-on" then
rednet.broadcast("water")
os.sleep(1)
rednet.broadcast("1")
rednet.broadcast("oil")
os.sleep(1)
rednet.broadcast("1")
print("All On.")
elseif inp == "all-off" then
rednet.broadcast("water")
os.sleep(1)
rednet.broadcast("2")
rednet.broadcast("oil")
os.sleep(1)
rednet.broadcast("2")
print("All Off.")
else
print("Error: Unknown Command!")
end
end
Comments