Advertisement
kizz12

MySexierLittleMenu

Jun 11th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. --Default Variable Settings--
  2. local alrm=true
  3. local lck=false
  4. local light=true
  5.  
  6. local function cleanup()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. --Object Manipulation Functions--
  12. local function toggleAlrm() --Alarm
  13.     alrm = not alrm
  14. end
  15.  
  16. local function toggleLck() --Locks
  17.     lck = not lck
  18. end
  19.  
  20. local function toggleLight() --Lights
  21.     light = not light
  22. end
  23.  
  24. --Setup--
  25. cleanup()
  26. --MainProgram--
  27. while true do
  28.  
  29. --Present Choices--
  30.     print'Welcome to Base Control'
  31.     print'Please make a selection:'
  32.  
  33.         print('1: '.. (alrm and "Disable" or "Enable" ) ..' Night Alarm')
  34.         print('2: '.. (lck and "Disable" or "Enable" ) ..' Base Lockdown')
  35.         print('3: '.. (light and "Disable" or "Enable" ) ..' Base Lighting')
  36.         print'4: Exit'
  37.  
  38.  
  39.     print''
  40.     --Pull Input--
  41.     write'Selection:'
  42.     local rInput=read()
  43.     rInput=tonumber(rInput)
  44.    
  45.     --Get States--
  46.     if alrm then
  47.         alrmState="Disable"
  48.     elseif not alrm then
  49.         alrmState="Enable"
  50.     end
  51.    
  52.     if lck then
  53.         lckState="Disable"
  54.     elseif not lck then
  55.         lckState="Enable"
  56.     end
  57.    
  58.     if light then
  59.         lightState="Disable"
  60.     elseif not light then
  61.         lightState="Enable"
  62.     end
  63.    
  64.     --Menu Value Masks--
  65.     local chAlrm=1
  66.     local chLck=2
  67.     local chLight=3
  68.     local chQuit=4
  69.    
  70. --Process Choice--     
  71.     if rInput==chAlrm then
  72.     print(''..alrmState..'ing alarm!')
  73.     toggleAlrm()   
  74.     elseif rInput==chLck then
  75.     print(''..lckState..'ing lockdown!')
  76.     toggleLck()
  77.     elseif rInput==chLight then
  78.     print(''..lightState..'ing lights!')
  79.     toggleLight()
  80.     elseif rInput==chQuit then
  81.     print'Closing!'
  82.     return
  83.     else
  84.     print'Invalid choice'
  85.     end
  86.  
  87.  
  88. --Cleanup--
  89. sleep(1)
  90. cleanup()
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement