Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local function GetOptions()
- local file = fs.open("Items.txt","r")
- local Data = textutils.unserialize(file.readAll())
- file.close()
- return Data
- end
- local function Menu()
- local Options = GetOptions()
- term.clear()
- term.setCursorPos(1,1)
- print("=====Menu=====")
- local Orders = {}
- for i = 1, #Options do
- Orders[i] = 0
- end
- Options[#Options + 1] = "save"
- local n = 1
- while true do
- for i = 1, #Options do
- term.setCursorPos(1,i + 1)
- term.clearLine()
- if n == i and Options[i] == "save" then term.write(">> save") elseif Options[i] == "save" then term.write("save") elseif n == i then term.write(">> ["..Orders[i].."] "..Options[i]) else term.write("["..Orders[i].."] "..Options[i]) end
- end
- local a, b = os.pullEvent("key")
- if b == keys.w and n > 1 then n = n - 1 end
- if b == keys.s and n < #Options then n = n + 1 end
- if b == keys.enter and Options[n] == "save" then break elseif b == keys.enter then Orders[n] = Orders[n] + 1 end
- end
- local Doc = fs.open("CustomerOrder.txt","w")
- Doc.write(textutils.serialize(Orders))
- Doc.close()
- term.clear()
- term.setCursorPos(1,1)
- print("please please tablet in Drive")
- repeat until 1 == 0
- end
- Menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement