Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("css")
- local user = "Debug"
- local w,h = css.width, css.height
- local balance = 0
- local loggedin = true
- local options = {
- "Deposit ",
- "Withdraw",
- "Transfer",
- " Logout ",
- }
- menu = css.createMenu(
- math.floor((w/2))-4, math.floor((h/2)) + 2,
- colors.orange,
- colors.red,
- 0.5,
- colors.red,
- colors.white,
- options
- )
- function screen()
- css.sbc(colors.white)
- css.clear()
- css.box(1,1,css.width, (css.height/2) - 1, colors.red)
- end
- function deposit()
- screen()
- css.stc(colors.white)
- css.cprint("DEPOSIT",2)
- css.cprint("Please enter the ammount of money",3)
- css.cprint("you would like to deposit into ",4)
- css.cprint("Account: " .. user,6)
- css.stc(colors.red)
- css.sbc(colors.white)
- css.cprint("Input ammount of money below.",12)
- css.cprint("Current balance: " .. balance, 16)
- css.sbc(colors.gray)
- css.scp((w/2) - 10, 14)
- write(string.rep(" ",20))
- css.stc(colors.white)
- css.scp((w/2) - 10, 14)
- money = read()
- --]] do money check logic here [[--
- atm()
- end
- function withdraw()
- screen()
- css.stc(colors.white)
- css.cprint("WITHDRAW",2)
- css.cprint("Please enter the ammount of money",3)
- css.cprint("you would like to withdraw from ",4)
- css.cprint("Account: " .. user,6)
- css.stc(colors.red)
- css.sbc(colors.white)
- css.cprint("Input ammount of money below.",12)
- css.cprint("Current balance: " .. balance, 16)
- css.sbc(colors.gray)
- css.scp((w/2) - 10, 14)
- write(string.rep(" ",20))
- css.stc(colors.white)
- css.scp((w/2) - 10, 14)
- money = read()
- --]] do money check logic here [[--
- atm()
- end
- function transfer()
- screen()
- css.stc(colors.white)
- css.cprint("TRANFER",2)
- css.cprint("Please enter the ammount of money",3)
- css.cprint("and the recipient account. ",4)
- css.cprint("From Account: " .. user,6)
- css.stc(colors.red)
- css.sbc(colors.white)
- css.cprint("Input ammount of money below.",10)
- css.cprint("Input recipient account below.",14)
- css.cprint("Current balance: " .. balance, 18)
- css.sbc(colors.gray)
- css.scp((w/2) - 10, 12)
- write(string.rep(" ",20))
- css.scp((w/2) - 10, 16)
- write(string.rep(" ",20))
- css.stc(colors.white)
- css.scp((w/2) - 10, 12)
- money = read()
- css.scp((w/2) - 10, 16)
- toaccount = read()
- --]] do transfer and money check logic here [[--
- atm()
- end
- function logout()
- screen()
- css.stc(colors.white)
- css.cprint("Thank you for choosing",2)
- css.cprint("Flyte Banking for the best",3)
- css.cprint("banking experience.",4)
- css.stc(colors.red)
- css.sbc(colors.white)
- for i =1, 5 do
- css.cprint("|",12)
- sleep(0.1)
- css.rlprint("/")
- sleep(0.1)
- css.rlprint("-")
- sleep(0.1)
- css.rlprint("\\")
- end
- --]] insert logout login here [[--
- login()
- end
- function atm()
- screen()
- --]] draw stuff
- css.stc(colors.white)
- css.cprint("Welcome to Flyte ATM",2)
- css.cprint("Select and Option below by",3)
- css.cprint("clicking one with your mouse.",4)
- css.cprint("Logged in as: " .. user, 6)
- css.cprint("Remember to logout when finished!",8)
- css.sbc(colors.white)
- css.stc(colors.lightGray)
- css.cprint("If there is a problem please contact",17)
- css.cprint("Relative or Lewisk3 or NilLogic",18)
- css.border((w/2) - 5, (h/2) + 1, (w/2) + 4, (h/2)+6, colors.orange)
- menu:draw()
- while loggedin do
- ev = {os.pullEvent()}
- value = menu:update(ev)
- if(value == options[1])then
- deposit()
- elseif(value == options[2])then
- withdraw()
- elseif(value == options[3])then
- transfer()
- elseif(value == options[4])then
- logout()
- end
- end
- end
- function signin()
- screen()
- css.stc(colors.white)
- css.cprint("LOGIN",2)
- css.cprint("Please enter account name",3)
- css.cprint("and password below. ",4)
- css.stc(colors.red)
- css.sbc(colors.white)
- css.cprint("Input Account Below.",10)
- css.cprint("Input Password Below.",14)
- css.sbc(colors.gray)
- css.scp((w/2) - 10, 12)
- write(string.rep(" ",20))
- css.scp((w/2) - 10, 16)
- write(string.rep(" ",20))
- css.stc(colors.white)
- css.scp((w/2) - 10, 12)
- username = read()
- css.scp((w/2) - 10, 16)
- password = read("*")
- --]] handle login logic here [[--
- user = username
- atm()
- end
- function register()
- screen()
- css.stc(colors.white)
- css.cprint("Register",2)
- css.cprint("Please enter a name",3)
- css.cprint("and a password below. ",4)
- css.stc(colors.red)
- css.sbc(colors.white)
- css.cprint("Input Username Below.",10)
- css.cprint("Input Password Below.",14)
- css.sbc(colors.gray)
- css.scp((w/2) - 10, 12)
- write(string.rep(" ",20))
- css.scp((w/2) - 10, 16)
- write(string.rep(" ",20))
- css.stc(colors.white)
- css.scp((w/2) - 10, 12)
- username = read()
- css.scp((w/2) - 10, 16)
- password = read("*")
- --]] handle register logic here [[--
- login()
- end
- function login()
- local inLogin = true
- local logopt = {
- " Login ",
- "Register",
- }
- log = css.createMenu(
- math.floor((w/2))-4, math.floor((h/2)) + 3,
- colors.orange,
- colors.red,
- 0.5,
- colors.red,
- colors.white,
- logopt
- )
- screen()
- --]] draw stuff
- css.stc(colors.white)
- css.cprint("Welcome to Flyte ATM",2)
- css.cprint("Select and Option below by",3)
- css.cprint("clicking one with your mouse.",4)
- css.cprint("Please login to your account", 6)
- css.sbc(colors.white)
- css.stc(colors.lightGray)
- css.cprint("If there is a problem please contact",17)
- css.cprint("Relative or Lewisk3 or NilLogic",18)
- css.border((w/2) - 5, (h/2) + 2, (w/2) + 4, (h/2)+5, colors.orange)
- log:draw()
- while inLogin do
- ev = {os.pullEvent()}
- value = log:update(ev)
- if(value == logopt[1])then
- inLogin = false
- signin()
- elseif(value == logopt[2])then
- inLogin = false
- register()
- end
- end
- end
- login()
Add Comment
Please, Sign In to add comment