Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this program deals with Cash Transfers, as sort of a Cash Register, or a Card Swipe, WIP
- Settings_AccountID = "Guest"
- Settings_PaymentMode = 0--0= Set Price, 1 = Choose item, 2 = Quanity of Item
- Settings_AdminCode = 0000
- Settings_Prices = [1,1,1,1,1]--prices for sold items
- Settings_Products = ["item","item","item","item","item"]
- Settings_CashRegisterState = "Closed"--Open or closed, closed will prevent any Use from Customers.
- --Sells
- Temp_Items = nil
- Temp_Total = 0
- Temp_CustomerAccount = nil
- local monitor = peripheral.find("monitor")
- start()
- function start()
- term.clear()
- Display("State")
- if Settings_CashRegiserState == "Open" then
- Standby()
- else
- print("this Register is Currently Closed")
- end
- end
- function Standby()
- term.clear()
- print("Please Wait for Cashier")
- local event, key = os.pullEvent("key")
- while true do
- Display("Total")
- if key == keys.1 then
- TempTotal = TempTotal + Settings_Prices[0]
- else if key == keys.2 && Settings_PaymentMode == 1 && Settings_Prices[1] != nil then
- TempTotal = TempTotal + Settings_Prices[1]
- else if key == keys.3 && Settings_PaymentMode == 1 && Settings_Prices[2] != nil then
- TempTotal = TempTotal + Settings_Prices[2]
- else if key == keys.4 && Settings_PaymentMode == 1 && Settings_Prices[3] != nil then
- TempTotal = TempTotal + Settings_Prices[3]
- else if key == keys.5 && Settings_PaymentMode == 1 && Settings_Prices[4] != nil then
- TempTotal = TempTotal + Settings_Prices[4]
- else if key == keys.enter then
- break
- sleep(20)
- CreditReader()
- end
- end
- end
- function CreditReader()
- print("Waiting for Customer to Insert Credit Card")
- Display("Write","Insert Card")
- while true do
- end
- end
- function Display(Action,Text)
- if Action == "Write" then
- monitor.setCursorPos(1,1)
- monitor.write(Text)
- else if Action == "Clear" then
- monitor.clear()
- else if Action == "Total" then
- monitor.setCursorPos(1,1)
- monitor.write(Temp_Total)
- else if Action == "State" then
- monitor.clear()
- monitor.setCursorPos(1,1)
- if Settings_CashRegisterState == "Open" then
- monitor.write("REGISTER IS OPEN")
- else if Settings_CashRegisterState == "Closed" then
- monitor.write("THIS REGISTER IS CLOSED")
- end
- end
- end
- function PaymentHandler()
- end
- function ErrorHandler()
- end
Add Comment
Please, Sign In to add comment