I'm trying to setup a text modifier for my server, where if you type something like hello ~world~ it would italic the 'world' part. I want to do this in Javascript, but I have no idea about how I would go about doing this.
Basically here's how scripting looks for where I'm running my server off of. This is also what I basically have done now, for this text modify script.
beforeChatMessage: function(src, message, chan) {
var user = sys.name(src);
var usercolor = sys.color(src)
if (message.toLowerCase().match("~")){
var italicmessage = message.replace(message, "<i>");
sys.sendHtmlAll("<font color="+usercolor+"><timestamp/> "+user+": "+italicmessage+"", channel);
return;
}
This obviously doesn't work, so, I'm guessing the correct way to would be to use substrings? Any help would be great.