“/my” commands in IRC

by gigaherz

It has been some time since the day I thought IRC was lacking a way to show ” * nick’s something” with “‘s” appended to the nickname without a space.

“/me” shows a space between the nickname and the text, so “/me ‘s whatever” doesn’t look nice.

So today I thought “if /me uses a ctcp ACTION, why not use ctcp SELF for /my?” and decided to write a short script which sent SELF ctcps when the user types /my, and handles SELF ctcps from other people to display them as ” * nick’s message”. This worked mostly well, except for some people’s IRC clients which would reply with an error message when they received the ctcp command.

Later I thought of a nicer solution which wouldn’t introduce any new CTCP command and would keep the messages compatible with every client.

The idea was to use normal ACTION messages where the beginning is “‘s”, and replace the messages so that if the text starts with “‘s”, it shows it without a space.

The resulting mIRC script, compatible with BOTH the first idea and the second one, is this:

alias my {
  if ( $left($active,1) == @ ) /halt
  if ( $active == Status Window ) /halt
  .me 's $$1-
  echo $color(own) $active $timestamp * $me $+ 's $$1-
}

on ^1:ACTION:'s *:#:{
  echo $color(action) $chan $timestamp * $nick $+ 's $$2-
  /haltdef
}

on ^1:ACTION:*:?:{
  if ( " $$1 " == " 's " ) {
    echo $color(action) $nick $timestamp * $nick $+ 's $$2-
    /haltdef
  }
}

CTCP 1:SELF *:*:{
  echo $color(action) $target $timestamp * $nick $+ 's $$2-
  /haltdef
}

To use it, you just have to paste the text into a mirc remotes script (you can open the script editor with alt+r, and use file->new to create a new file).

Advertisements