Search code examples
colorshyperlinkircmirc

How do I change the color of links in mIRC?


In mIRC I want all links to look like html links (blue with an underline) so they stick out in channels and messages. I'm sure I have to write a remote script but I'm not sure what the code would be.


Solution

  • Update: This works on the first URL matched in the text. I couldn't quite get it working with multiple links.

    Please note that modifying channel output has several side-effects, most notably is that multiple spaces will be condensed to one (similar to how whitespace is treated in HTML). If you are using any other scripts that modify channel output, this may interfere or even override those scripts.

    I haven't dealt with mIRC's RegEx functions before, so there may be a cleaner way of doing this:

    on ^*:TEXT:*:#:{
      set -u %tmp.match /((ht|f)tp[s]?:\S+)/i
      if ($regex(links, $1-, %tmp.match) > 0) {
        set -u %tmp.text $regsubex(links, $1-, %tmp.match, $chr(31) $+ $chr(3) $+ 12 $+ \t $+ $chr(3) $+ $chr(31))
        echo $timestamp $chan < $+ $nick $+ > %tmp.text
        halt
      }
    }
    

    Notes: set -u deletes the variable after the script runs, $chr(3) is the Control Code for Color, 12 is the Color Number for URL Blue, and $chr(31) is the Control Code for Underline.