blob: d0e73cc80a48dc4278a90aa284c54eb6580224ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
local man = peripheral.find"manipulator"
assert(man and man.hasModule"plethora:chat")
local m = peripheral.wrap"monitor"
assert(m)
local function p(...)
term.redirect(m)
print(...)
term.redirect(term.native())
end
local function score(msg)
local s = 0
for num in msg:gmatch"%-?%d+" do s=s+num end
return s
end
while true do
local _,user,msg = os.pullEvent"chat_message"
local s = score(msg)
p(string.format("(%d) <%s> %s",s,user,msg))
end
|