Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this script allows the purchase and reactivation of National Train Line Credit Cards, which are used for payment of tickets and allows entrence innmost Train stations
- local w, h = term.getSize()
- local Credit = 0
- local User = "guest"
- local AvailableLines = {"Northern Outpost"}
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function CUI(m) --declare function
- n=1
- local l = #m
- while true do
- term.setCursorPos(1,5)
- for i=1, #m, 1 do --traverse the table of options
- if i==n then term.clearLine() print(i, " ["..m[i].."]") else term.clearLine() print(i, " ", m[i]) end --print them
- end
- a, b= os.pullEvent("key") --wait for keypress
- if b==keys.w and n>1 then n=n-1 end
- if b==keys.s and n<l then n=n+1 end
- if b==keys.enter then break end
- end
- return n --return the value
- end
- local function PageDraw(page)
- if page == "Login" then
- term.setBackgroundColor(colors.cyan)
- Clear()
- print("Central Rail Network Kiosk")
- print("Please Login")
- term.write("Code = ")
- elseif page == "Menu" then
- term.setBackgroundColor(colors.green)
- Clear()
- print("Central Rail Network Kiosk")
- print("Hello, "..User)
- elseif page == "Swipe" then
- elseif page == "Lines" then
- term.setBackgroundColor(colors.black)
- Clear()
- print("Central Rail Network Kiosk")
- elseif page == "Line Details" then
- end
- end
- local function AccountPage()
- end
- local function LinesPage()
- end
- local function LineDetails(LineName)
- end
- local function TicketsPage()
- local Options = AvailableLines
- Options[#Options +1] = "exit"
- local n = CUI(Options)
- if Options[n] == "exit" then
- MainMenu()
- else
- LineDetails(Options[n])
- end
- end
- local function MainMenu()
- PageDraw("Menu")
- local Options = {"Account","Lines","Buy Ticket","Logout"}
- local n = CUI(Options)
- if Options[n] == "Account" then
- AccountPage()
- elseif Options[n] == "Lines" then
- LinesPage()
- elseif Options[n] == "Buy Ticket" then
- TicketsPage()
- elseif Options[n] == "Logout" then
- Logout()
- end
- end
- local function Login()
- PageDraw("Login")
- local input
- while true do
- input = read
- if string.len(input) == 6 then
- break
- end
- end
- local file = fs.open("Users","r")
- local Contents = file.readAll()
- if Contents.find(input) == true then
- User = input
- MainMenu()
- else
- Login()
- end
- end
- local function Logout()
- User = "guest"
- PageDraw("Login")
- end
Add Comment
Please, Sign In to add comment