Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Storages = {}--dispenser, access, products, payment
- local Display
- local Products = {}--itemname,itemid, price
- local Currency = {{"createdeco:brass_coin",64},{"createdeco:iron_coin",16},{"createdeco:copper_coin",1}}
- local Mode = 0-- -1 disabled, 0 setup, 1 normal, 2 debug, 3 admin
- local Cart = {}
- function boot()
- end
- function UI()
- local Monitor = peripheral.wrap(Display)
- local function ProductBox(I,image)
- local Y = math.floor(I/3+0.7)
- local X = I - (Y*3)
- local file = fs.open(image,"r")
- local Line
- repeat
- Line = file.readLine()
- if Line ~= nil then Monitor.setCursorPos(X,Y) for x = 1, string.len(Line) do Monitor.setCursorPos((X-1)+x,Y) Monitor.blit("0",string.sub(Line,x,1),string.sub(Line,x,1)) end Y = Y + 1 end
- until Line == nil
- file.close()
- end
- local function Stats()
- local Cost = 0
- for I = 1, #Cart do
- Cost = Cost + (Cart[I][1]*Cart[I][2])
- end
- Monitor.setCursorPos(1,25)
- Monitor.write(Cost)
- Monitor.setCursorPos(1,26)
- Monitor.write("Purchase?")
- Monitor.setCursorPos(1,27)
- Monitor.write("Y/N")
- end
- Monitor.clear()
- for i = 1, #Products do
- ProductBox(i,"default.npf")
- end
- Stats()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement