Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Default Variable Settings--
- local alrm=true
- local lck=false
- local light=true
- local function cleanup()
- term.clear()
- term.setCursorPos(1,1)
- end
- --Object Manipulation Functions--
- local function toggleAlrm() --Alarm
- alrm = not alrm
- end
- local function toggleLck() --Locks
- lck = not lck
- end
- local function toggleLight() --Lights
- light = not light
- end
- --Setup--
- cleanup()
- --MainProgram--
- while true do
- --Present Choices--
- print'Welcome to Base Control'
- print'Please make a selection:'
- print('1: '.. (alrm and "Disable" or "Enable" ) ..' Night Alarm')
- print('2: '.. (lck and "Disable" or "Enable" ) ..' Base Lockdown')
- print('3: '.. (light and "Disable" or "Enable" ) ..' Base Lighting')
- print'4: Exit'
- print''
- --Pull Input--
- write'Selection:'
- local rInput=read()
- rInput=tonumber(rInput)
- --Get States--
- if alrm then
- alrmState="Disable"
- elseif not alrm then
- alrmState="Enable"
- end
- if lck then
- lckState="Disable"
- elseif not lck then
- lckState="Enable"
- end
- if light then
- lightState="Disable"
- elseif not light then
- lightState="Enable"
- end
- --Menu Value Masks--
- local chAlrm=1
- local chLck=2
- local chLight=3
- local chQuit=4
- --Process Choice--
- if rInput==chAlrm then
- print(''..alrmState..'ing alarm!')
- toggleAlrm()
- elseif rInput==chLck then
- print(''..lckState..'ing lockdown!')
- toggleLck()
- elseif rInput==chLight then
- print(''..lightState..'ing lights!')
- toggleLight()
- elseif rInput==chQuit then
- print'Closing!'
- return
- else
- print'Invalid choice'
- end
- --Cleanup--
- sleep(1)
- cleanup()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement