Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Base Control System --
- function lighting_control(cmd)
- if cmd == "on" then
- rednet.send(92,"command_lights_on")
- test,id,message = os.pullEvent("rednet_message")
- if message == "status_92_lights_on" then
- return "status_lights_already_on"
- elseif message == "status_92_lights_turned_on" then
- return "status_lights_turned_on"
- else
- return "status_error"
- end
- elseif cmd == "off" then
- rednet.send(92,"command_lights_off")
- test,id,message = os.pullEvent("rednet_message")
- if message == "status_92_lights_off" then
- return "status_lights_already_off"
- elseif message == "status_92_lights_turned_off" then
- return "status_lights_turned_off"
- else
- return "status_error"
- end
- elseif cmd == "check" then
- rednet.send(92,"command_lights_check")
- test,id,message = os.pullEvent("rednet_message")
- if message == "status_92_lights_on" then
- return "status_lights_on"
- elseif message == "status_92_lights_off" then
- return "status_lights_off"
- end
- end
- end
- function basiccontrol_beta(command)
- if command == "on" then
- temp = lighting_control("on")
- if temp == "status_lights_already_on" then
- message = "Lights Already On"
- elseif temp == "status_lights_turned_on" then
- message = "Lights Turned On"
- end
- elseif command == "off" then
- temp = lighting_control("off")
- if temp == "status_lights_already_off" then
- message = "Lights Already Off"
- elseif temp == "status_lights_turned_off" then
- message = "Lights Turned Off"
- end
- end
- end
- args = {...}
- command = args[1]
- basiccontrol_beta(command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement