Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ATMApi.lua")
- os.pullEvent = os.pullEventRaw
- local w,h = term.getSize()
- local title = "Choose option"
- local ch_1 = "Card's info"
- local ch_2 = "Deposite"
- local ch_3 = "Withdraw"
- local ch_4 = "Pay"
- local ch_5 = "Log out"
- local nOption = 1
- function update()
- term.clear()
- local t1 = ch_1
- local t2 = ch_2
- local t3 = ch_3
- local t4 = ch_4
- local t5 = ch_5
- if nOption == 6 then nOption = 5 end
- if nOption == 0 then nOption = 1 end
- if nOption == 1 then t1 = "[ " .. t1 .. " ]"
- elseif nOption == 2 then t2 = "[ " .. t2 .. " ]"
- elseif nOption == 3 then t3 = "[ " .. t3 .. " ]"
- elseif nOption == 4 then t4 = "[ " .. t4 .. " ]"
- elseif nOption == 5 then t5 = "[ " .. t5 .. " ]"
- end
- ATMApi.printCent(math.floor(h/2) - 3, title)
- ATMApi.printCent(math.floor(h/2) - 1, t1)
- ATMApi.printCent(math.floor(h/2), t2)
- ATMApi.printCent(math.floor(h/2) + 1, t3)
- ATMApi.printCent(math.floor(h/2) + 2, t4)
- ATMApi.printCent(math.floor(h/2) + 3, t5)
- end
- update()
- while true do
- local event, key = os.pullEvent("key")
- if key == keys.enter then
- if ATMApi.cardIn() == true then
- if nOption == 1 then shell.run("card_info") end
- else shell.run("main")
- end
- if nOption == 5 then shell.run("main") end
- elseif key == keys.down then
- nOption = nOption + 1
- elseif key == keys.up then
- nOption = nOption - 1
- end
- update()
- end
- --shell.run("main_menu")
- --rednet.open("top")
- --rednet.send(0, "client 948211")
- --id, message = rednet.receive()
- --print(message.pass)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement