summaryrefslogtreecommitdiff
path: root/shop.lua
diff options
context:
space:
mode:
Diffstat (limited to 'shop.lua')
-rw-r--r--shop.lua22
1 files changed, 17 insertions, 5 deletions
diff --git a/shop.lua b/shop.lua
index 7f986c9..ea05a85 100644
--- a/shop.lua
+++ b/shop.lua
@@ -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