Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --CatInterfaces(TM)
- --Security Control Panel V1.0
- --Property of Cat and Token Enterprises
- password = "cats"
- options = {"Open Doors","Turn off Nuclear Reactor","Turn on Nuclear Reactor","Exit"}
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function center(msg)
- k = (50-string.len(msg))/2
- j = 0
- spacer = ""
- while j < k do
- spacer = spacer.." "
- j = j + 1
- end
- msg = spacer..msg
- return msg
- end
- function banner(msg)
- spanner = "=================================================="
- header = spanner..'\n'..center(msg)..'\n'..spanner
- return header
- end
- function selection()
- k = table.getn(options)
- sEvent, param = os.pullEvent("key")
- if param == 200 then return 1 end
- if param == 208 then return -1 end
- --if --rawkeyinput == enter then return 999
- end
- function menu(selected, bannermsg)
- print (banner(bannermsg))
- k = table.getn(options)
- j = 1
- temp = {}
- temp = options
- draw = ""
- temp[selected] = ">"..temp[selected].."<"
- while j < k do
- msg = temp[j]
- draw = draw..'\n'..center(msg)
- j = j + 1
- end
- temp = {}
- print (draw)
- end
- clear()
- menu(1,"Your options are as follow.") --[primer statement]
- potato = 4
- choose = 1
- while potato ~= 0 do
- clear()
- menu(choose,"Your options are as follow.")
- choose = choose + selection()
- end
Add Comment
Please, Sign In to add comment