summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-12-30 00:08:24 +0000
committerubq323 <ubq323@ubq323.website>2022-12-30 00:08:24 +0000
commitc18661a230dae15ce3056604173c468687ce908d (patch)
tree223a26f853138b8d040340fda52e21b082956d3f
parent69be7325be00c5cc56138228b667b5c2e20947ec (diff)
shop
-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