skip to navigation skip to content

furrymuck name script

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, but generally works...

Also, this is meant for Mudlet, but might work with other chat clients.

a layout highlighting the visual ui for the script window

Navigate to the Scripts menu; a button to it should be along the top of Mudlet's interface.

Click on 'Add Script', name the script, and then paste the code below into the text field.

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

a screenshot of the layout of the triggers section

On the left side, click on Triggers, then click Add Trigger, name this trigger, then paste this Perl Regex code in:

Perl Regex: ^(\S+) (.+)(,|:|\.) "(.*)"(.*)$

Then, paste this code into the white textbox below all of this info:

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()

You can also cause it to play a notification sound if it gets triggered. There's an option for it on the right-hand side.

With all that done, simply save and say something to test if it works! It should look like this:

a screenshot of a terminal that shows me saying 'say awawa' and then outputting 'You yap, awawa' with the word You in green

This should assign a random color to all names.