Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("---------------------------------")
- print("Welcome to Smart-House Software")
- print("Please Select a Task")
- print("---------------------------------")
- alarmout = "left"
- alarmstat = "on"
- alarmfinish = "0"
- lightout = "back"
- lightstat = "on"
- loop = 0
- print("1.Turn " ..lightstat.. " Lights")
- print("2.Turn " ..alarmstat.. " Alarm")
- print("3.Change outputs")
- print("---------------------------------")
- while loop == 0 do
- function Printit()
- print("---------------------------------")
- print("Welcome to Smart-House Software")
- print("Please Select a Task")
- print("---------------------------------")
- print("1.Turn " ..lightstat.. " Lights")
- print("2.Turn " ..alarmstat.. " Alarm")
- print("3.Change outputs")
- print("---------------------------------")
- task = read()
- end
- task = read()
- if task == "debug" then
- print("---------------------------------")
- print("Debugging Activated")
- print("Type stop to finish Debugging")
- print("---------------------------------")
- break
- end
- if task == "1" or task == "lights" then
- if lightstat == "off" then
- loop = 1
- redstone.setOutput(lightout, true)
- print("---------------------------------")
- print("Lights have been turned on")
- print("---------------------------------")
- sleep (5)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- lightstat = "on"
- loop = 0
- end
- if lightstat == "on" then
- loop = 1
- redstone.setOutput(lightout, false)
- print("---------------------------------")
- print("Lights have been turned off")
- print("---------------------------------")
- sleep (5)
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------------------")
- print("Welcome to Smart-House Software")
- print("Please Select a Task")
- print("---------------------------------")
- print("1.Turn " ..lightstat.. " Lights")
- print("2.Turn " ..alarmstat.. " Alarm")
- print("3.Change outputs")
- print("---------------------------------")
- lightstat = "off"
- loop = 0
- end
- end
- if task == "2" or task == "alarm" then
- if alarmstat == "on" then
- alarmstat = "off"
- alarmfinish = "0"
- print("---------------------------------")
- print("Alarm has been turned on")
- print("---------------------------------")
- loop = 1
- sleep (5)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- while alarmfinish == "0" do
- sleep(1)
- redstone.setOutput(alarmout, true)
- sleep(0.5)
- redstone.setOutput(alarmout, false)
- alarmfinish = "1"
- alarmstat = "off"
- end
- end
- if alarmstat == "off" then
- alarmstat = "on"
- print("---------------------------------")
- print("Alarm has been turned off")
- print("---------------------------------")
- alarmfinish = "1"
- loop = 1
- sleep (5)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- end
- if task == "3" or task == "change" then
- loop = 1
- term.clear()
- term.setCursorPos(1,1)
- print("---------------------------------")
- print("What Output would you like to change?")
- print("---------------------------------")
- print("Lights")
- print("Alarm")
- print("---------------------------------")
- output = read()
- loop = 0
- if output == "Lights" or output == "lights" then
- term.clear()
- term.setCursorPos(1,1)
- loop = 1
- print("---------------------------------")
- print("Light Output")
- print("---------------------------------")
- print("Please type the direction in which you want to output power")
- print("---------------------------------")
- print("List of Directions")
- print("---------------------------------")
- print("Front")
- print("Back")
- print("Left")
- print("Right")
- print("---------------------------------")
- loop = 0
- direction = read()
- if direction == "Front" or direction == "front" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- lightout = "front"
- loop = 1
- print("---------------------------------")
- print("Light Output set to " ..lightout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- elseif direction == "Back" or direction == "back" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- lightout = "back"
- loop = 1
- print("---------------------------------")
- print("Light Output set to " ..lightout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- elseif direction == "Left" or direction == "left" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- lightout = "left"
- loop = 1
- print("---------------------------------")
- print("Light Output set to " ..lightout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- elseif direction == "Right" or direction == "right" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- lightout = "right"
- loop = 1
- print("---------------------------------")
- print("Light Output set to " ..lightout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- end
- end
- if output == "alarm" or output == "Alarm" then
- term.clear()
- term.setCursorPos(1,1)
- loop = 1
- print("---------------------------------")
- print("Alarm Output")
- print("---------------------------------")
- print("Please type the direction in which you want to output power")
- print("---------------------------------")
- print("List of Directions")
- print("---------------------------------")
- print("Front")
- print("Back")
- print("Left")
- print("Right")
- print("---------------------------------")
- loop = 0
- adirection = read()
- if adirection == "Front" or adirection == "front" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- alarmout = "front"
- loop = 1
- print("---------------------------------")
- print("Alarm Output set to " ..alarmout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- elseif adirection == "Back" or adirection == "back" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- alarmout = "back"
- loop = 1
- print("---------------------------------")
- print("Alarm Output set to " ..alarmout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- elseif adirection == "Left" or adirection == "left" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- alarmout = "left"
- loop = 1
- print("---------------------------------")
- print("Alarm Output set to " ..alarmout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- elseif adirection == "Right" or adirection == "right" then
- if lightout == alarmout then
- print("---------------------------------")
- print("Please Choose another Direction")
- print("---------------------------------")
- else
- alarmout = "right"
- loop = 1
- print("---------------------------------")
- print("Alarm Output set to " ..alarmout.. " side")
- print("---------------------------------")
- sleep(3)
- term.clear()
- term.setCursorPos(1,1)
- Printit()
- loop = 0
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement