diff options
-rw-r--r-- | shop.lua | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -127,8 +127,8 @@ end function run_sidedisp() local m = peripheral.wrap("left") - m.clear() local function printseq(q) + m.clear() for _,v in ipairs(q) do if type(v) == "number" then m.setTextColor(v) @@ -140,14 +140,26 @@ function run_sidedisp() end end while true do + local sa = stock_amt() printseq { {7,1}, colors.orange, "UBQ323", {3,2}, "DIAMOND STORE", {9,3}, "!!!", - {1,5}, colors.white, "Stock: ", colors.yellow, ""..stock_amt(), - {1,6}, colors.white, "Price: ", colors.yellow, ""..PRICE, colors.white, "kst/item", - {2,8}, colors.blue, "/pay d@ac.kst "..PRICE + {1,5}, colors.white, "Stock: ", colors.yellow, ""..sa, + {1,6}, colors.white, "Price: ", colors.yellow, ""..PRICE, colors.white, "kst/item" } - os.sleep(5) + if sa > 0 then + printseq { + {2,8}, colors.blue, "/pay d@ac.kst "..PRICE, + {2,9}, colors.grey, "(or a multiple of "..PRICE..")", + } + else + printseq { + {2,8}, colors.red, "Out of stock!", + {2,9}, "please come back soon", + } + + end + os.sleep(2) end end |