Guest User

Untitled

a guest
Sep 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1.  
  2. --CatInterfaces(TM)
  3.  
  4. --Security Control Panel V1.0
  5. --Property of Cat and Token Enterprises
  6.  
  7. password = "cats"
  8. options = {"Open Doors","Turn off Nuclear Reactor","Turn on Nuclear Reactor","Exit"}
  9.  
  10. function clear()
  11. term.clear()
  12. term.setCursorPos(1,1)
  13. end
  14.  
  15. function center(msg)
  16. k = (50-string.len(msg))/2
  17. j = 0
  18. spacer = ""
  19. while j < k do
  20. spacer = spacer.." "
  21. j = j + 1
  22. end
  23. msg = spacer..msg
  24. return msg
  25. end
  26.  
  27. function banner(msg)
  28. spanner = "=================================================="
  29. header = spanner..'\n'..center(msg)..'\n'..spanner
  30. return header
  31. end
  32.  
  33. function selection()
  34. k = table.getn(options)
  35. sEvent, param = os.pullEvent("key")
  36. if param == 200 then return 1 end
  37. if param == 208 then return -1 end
  38. --if --rawkeyinput == enter then return 999
  39. end
  40.  
  41. function menu(selected, bannermsg)
  42. print (banner(bannermsg))
  43. k = table.getn(options)
  44. j = 1
  45. temp = {}
  46. temp = options
  47. draw = ""
  48. temp[selected] = ">"..temp[selected].."<"
  49. while j < k do
  50. msg = temp[j]
  51. draw = draw..'\n'..center(msg)
  52. j = j + 1
  53. end
  54. temp = {}
  55. print (draw)
  56. end
  57.  
  58. clear()
  59. menu(1,"Your options are as follow.") --[primer statement]
  60.  
  61. potato = 4
  62. choose = 1
  63. while potato ~= 0 do
  64. clear()
  65. menu(choose,"Your options are as follow.")
  66. choose = choose + selection()
  67. end
Add Comment
Please, Sign In to add comment