Just a test to try and figure this client out.
Here's my output:
3297h, 3894m cexkdb-
When it should be:
3297h, 3894m cexkdb-3297(100)h,
here's my code:
Code: Select all
RegExp: ^(\d+)h\, (\d+)m (\w+)\-$
-- Acquire current/previous health/mana
hp.prev = hp.cur
mp.prev = mp.cur
hp.cur = tonumber(matches[2])
mp.cur = tonumber(matches[3])
-- Acquire defences
local defs = matches[4]
aff.prone = (string.find (defs, 'p') ~= nil)
bal.bal = (string.find (defs, 'x') ~= nil)
bal.eq = (string.find (defs, 'e') ~= nil)
def.blind = (string.find (defs, 'b') ~= nil)
def.deaf = (string.find (defs, 'd') ~= nil)
def.phased = (string.find (defs, '@') ~= nil)
hp.per = math.floor (100 * ( hp.cur / hp.max ))
mp.per = math.floor (100 * ( mp.cur / mp.max ))
if hp.per > 66 then
hp.col = 'green'
elseif hp.per > 33 then
hp.col = 'gold'
elseif hp.per > 0 then
hp.col = 'red'
else
hp.col = 'silver'
end
if mp.per > 66 then
mp.col = 'green'
elseif mp.per > 33 then
mp.col = 'gold'
elseif mp.per > 0 then
mp.col = 'red'
else
mp.col = 'silver'
end
cecho ('green', 'black',hp.cur)
cecho ('silver','black','('..hp.per..')h,')
Code: Select all
color_table = {
green = {0, 128, 0},
lime = {0, 255, 0},
silver = {192, 192, 192},
}
function cecho (fgcol, bgcol, str)
fg(fgcol)
bg(bgcol)
echo (str)
resetformat()
end