>> swifty's hq v2.2 > main > fm > custom
Name Highlights
This code comes from my friend Willo. This script highlights your name - or the name of whoever is talking - so you don't miss any messages in the chat. Note that it can be a little overzealous or inconsistent...
Also, this is meant for Mudlet, but might work with other chat clients.
In Scripts, add:
function string.tobyte(str)
return (str:gsub('.', function (c)
return string.byte(c)
end))
end
function string.tocolor(str)
math.randomseed(string.cut(string.tobyte(str), 18))
local r = math.random(0,255)
local g = math.random(0,255)
local b = math.random(0,255)
math.randomseed(os.time())
return {r,g,b}
end
function colorMungeEcho(strForColor, strToEcho)
local color = "<" .. table.concat(string.tocolor(strForColor), ",") .. ">"
decho(color .. strToEcho .. "\n")
end
In triggers, add:
New Chat MSG:
Perl Regex: ^(\S+) (.+)(,|:|\.) "(.*)"(.*)$
On-trigger code:
selectString(matches[1], 1)
bg("light_gray")
fg("black")
selectString(matches[2], 1)
local colors = string.tocolor(matches[2])
setBgColor(colors[1], colors[2], colors[3])
if colors[1] + colors[2] + colors[3] > 380 then
setFgColor(0,0,0)
end
resetFormat()