I meant open CCSensors,but I also have openP.Addons.
And Here is the code…
local regNum = 1
local defaultB = colors.gray
local defaultT = colors.black
local user = " "
local storeName = "Classic's Store"
local menuBoard = "monitor_0"
function resetPost()
term.setBackgroundColor(defaultB)
term.clear()
term.setCursorPos(1,1)
titleBar()
end
function reset()
term.setBackgroundColor(defaultB)
term.clear()
term.setCursorPos(1,1)
end
function titleBar()
term.setBackgroundColor(colors.red)
term.setTextColor(defaultT)
term.setCursorPos(2,1)
term.clearLine()
print("Register Number: "..regNum)
term.setCursorPos(2,2)
term.clearLine()
print("You are logged in as: "..user)
term.setBackgroundColor(defaultB)
end
function login()
reset()
username = {"this slot", "00000"}
name = {"never works", "Admin"}
i = #username
write("Enter Your Cashier ID: ")
user = read()
for i = 1, i do
if user == username[i] then
access = true
user = name[i]
break
else
access = false
end
end
if access == true then
print("Logging in...")
sleep(1)
cash()
elseif access == false then
print("Incorrect username and password combination")
sleep(2)
os.reboot()
end
end
function cash()
resetPost()
term.setCursorPos(1,4)
print("[1] Write a Receipt")
print("[2] Do Inventory")
print("[3] Reboot Menu Board")
print("[4] Logout")
term.write("Enter your selection: ")
input = read()
if input == "1" then
receipt()
elseif input == "2" then
inventory()
elseif input == "3" then
menureboot()
elseif input == "4" then
os.reboot()
else
print("Invalid Response")
sleep(2)
cash()
end
end
local inventoryItems = {"blah", "blah2", "blah3", "blah4", "blah5"}
local price = {"1", "2", "3", "4", "5000"}
function menureboot()
m = peripheral.wrap(menuBoard)
iitems = #inventoryItems
monWidth,monHeight = m.getSize()
m = peripheral.wrap("monitor_0")
m.clear()
m.setCursorPos(1,1)
m.write("Welcome to")
m.setCursorPos(1,2)
m.write(storeName)
local trueH = iitems/monHeight
local appH = math.ceil(trueH)
if appH > 5 then
appH = 5
end
m.setTextScale(appH)
for i = 1, iitems do
m.setCursorPos(1,i+3)
m.write(inventoryItems[i])
local totalList = #inventoryItems[i] + #price[i] + 1
local emptySpaces = monWidth - totalList
for i = 1, emptySpaces do
m.write(".")
end
m.write(price[i].."$")
end
end
menureboot()
--login()
NOTE: I am aware of the error in line 88. And I'm sorry that I cant figure out how to make it so you can show/hide the code.