Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local event
- local key
- local stop
- local amount
- local pass
- local ID
- local message
- local protocol
- function ret()
- print("Returning to home screen...")
- sleep(2.5)
- end
- function inv()
- print("Invalid input!")
- ret()
- end
- function amt()
- print("How much? Please type a numerical amount below.")
- event, key = os.pullEvent("key")
- amount = read()
- print(amount .. " coin(s)? Y/N")
- end
- function sd()
- print("Success!")
- print("Goodbye!")
- stop = 1
- sleep(2.5)
- end
- term.clear()
- term.setCursorPos(1,1)
- stop = 0
- rednet.open("back")
- repeat
- print("Welcome to the OTS ATM Network!")
- print("Please press W to withdraw or D to deposit.")
- event, key = os.pullEvent("key")
- if key == 17 then
- print("Withdrawal? Y/N")
- event, key = os.pullEvent("key")
- if key == 21 then
- amt()
- event, key = os.pullEvent("key")
- if key == 21 then
- rednet.send(5,amount,"atm.buy")
- print("Transaction sent! Please see game chat for more.")
- ret()
- elseif key == 49 then
- ret()
- else
- inv()
- end
- elseif key == 49 then
- ret()
- else
- inv()
- end
- elseif key == 32 then
- print("Deposit? Y/N")
- event, key = os.pullEvent("key")
- if key == 21 then
- amt()
- event, key = os.pullEvent("key")
- if key == 21 then
- rednet.send(5,amount,"atm.sell")
- print("Transaction sent! Please see game chat for more.")
- ret()
- elseif key == 49 then
- ret()
- else
- inv()
- end
- elseif key == 49 then
- ret()
- else
- inv()
- end
- elseif key == 211 then
- print("Shutdown ATM? Y/N")
- event, key = os.pullEvent("key")
- if key == 21 then
- print("Please enter network password below, or E to exit.")
- event, key = os.pullEvent("key")
- pass = read()
- if pass == "E" then
- ret()
- elseif pass == "e" then
- ret()
- else
- print("Waiting on response from master server...")
- rednet.send(5,pass,"atm.stop")
- ID, message, protocol = rednet.receive("atm.stop",5)
- if ID == 5 then
- if message == "OKAY" then
- sd()
- elseif message == "NO" then
- print("Unauthorized user!")
- ret()
- else
- print("Hmm... Something went wrong.")
- ret()
- end
- else
- print("No response, master server may be down.")
- print("Please enter local backup password below.")
- event, key = os.pullEvent("key")
- pass = read()
- if pass == "artemis25" then
- sd()
- else
- inv()
- end
- end
- end
- elseif key == 49 then
- ret()
- else
- inv()
- end
- else
- inv()
- end
- term.clear()
- term.setCursorPos(1,1)
- until stop == 1
- rednet.close("back")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement