summaryrefslogtreecommitdiff
path: root/chat.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-08-04 02:28:58 +0100
committerubq323 <ubq323@ubq323.website>2022-08-04 02:28:58 +0100
commit493051411c6f2376b7de9bcde10d1d90b575c7a3 (patch)
treead74380f4f8bed2a93b4706c93cef01ac7b7134d /chat.lua
parent4e6d4d25d72d0c0a8bd4cc3df6d865eab338aed9 (diff)
chat
Diffstat (limited to 'chat.lua')
-rw-r--r--chat.lua36
1 files changed, 30 insertions, 6 deletions
diff --git a/chat.lua b/chat.lua
index f175c77..14d1334 100644
--- a/chat.lua
+++ b/chat.lua
@@ -7,13 +7,15 @@ M.setTextScale(0.5)
local Mw,Mh = M.getSize()
local lbw = 4+16+10
local wLog = window.create(M,1,1,Mw-lbw,Mh)
-wLog.setBackgroundColor(colors.blue)
-wLog.clear()
-wLog.write("LOG")
+-- wLog.setBackgroundColor(colors.blue)
+-- wLog.clear()
+-- wLog.write("LOG")
local wLb = window.create(M,Mw-lbw+1,1,lbw,11)
-wLb.setBackgroundColor(colors.red)
-wLb.clear()
-wLb.write("LB")
+-- wLb.setBackgroundColor(colors.red)
+-- wLb.clear()
+-- wLb.write("LB")
+
+-- utils
local function p(thing,...)
local o=term.redirect(thing)
@@ -21,6 +23,28 @@ local function p(thing,...)
term.redirect(o)
end
+local function pad_r(s,width)
+ return string.rep(" ",width-#tostring(s))..s
+end
+
+-- drawing
+-- lb
+
+local function draw_lb(W,scores)
+ W.setBackgroundColor(colors.gray)
+ W.clear()
+
+ -- numbers
+ W.setTextColor(colors.yellow)
+ for line=1,10 do
+ W.setCursorPos(1,line)
+ W.write(pad_r(line,2)..".")
+ end
+end
+
+draw_lb(wLb,nil)
+
+
local function score(msg)
local s = 0
for num in msg:gmatch"%-?%d+" do s=s+num end