Note: The mainteinance of the scripting examples is discontinued since I no longer have an interest to continue doing so. The pages will remain here, for now, but that might not be the case in the future. You are free to download all the material on these pages and set a up mirror, or even continue the maintenance of the material by enhancing the examples yourself.

All the material in these examples are for the mIRC version 6.03. It is very likely that some or most of these examples won't work in future versions.

Scripting all channel messages and events into one window

mIRC is a GUI (Graphical User Interface) client and like most GUI clients do, mIRC puts all channels into their own windows. Messages and joins to #chat go to #chat window, messages and joins to #idle go to #idle window etc. Sometimes it would be nice to see all channels in a single window. I do this when I'm doing something else, like watching a movie from television, while I still want to take a look at IRC once in a while. Someone might say this is a perfect symptom of IRC addiction. :-) Naturally there are many other reasons, usually very individual, but I know that people sometimes request this feature.

If you want to understand this script, I suggest that you take a look at the other pages dealing with creating custom output. I've explained the events, their syntax, and example implementations with rather great detail so this page won't include the same story again. The only unique technique in the script is the use of custom windows. Custom windows are windows you can use to display text and graphics in your own special way. This script merely opens a new custom window with default settings and then uses /echo with the window as target. I admit that is a very basic way of using custom windows but that doesn't mean you should stick with the basic way. There are tons of options documented in the help file. If you want to take advantage of them, get to know them!

This script leaves the existing channel windows as they are. It doesn't halt any output. It simply leaves the channel windows as they are but creates a new window where all channel messages and events are written.

Example script

; Open a custom window called @IRC when mIRC starts
on *:START: window @IRC

; If the user tries to close @IRC, open it again
; This is a kludge but unfortunately it's hard to come up with a better solution
on *:CLOSE:@IRC: .timer 1 0 window @IRC

; Since $network doesn't always return value, use $server for the network name if $network fails
alias -l networkname {
  if ( $network ) return $network
  return $server
}

; Channel messages

on *:TEXT:*:#: echo $color(normal text) -mlti2 @IRC < $+ $networkname $+ : $+ $target $+ : $+ $nick $+ > $strip($1-,m)
on *:ACTION:*:#: echo $color(action text) -mlti2 @IRC * $networkname $+ : $+ $target $+ : $+ $nick $strip($1-,m)
on *:NOTICE:*:#: echo $color(notice text) -mlti2 @IRC - $+ $networkname $+ : $+ $target $+ : $nick $+ - $strip($1-,m)

; Channel events

on *:JOIN:#: echo $color(join text) -t @IRC * $nick ( $+ $address $+ ) has joined $networkname $+ / $+ $chan
on *:PART:#: echo $color(part text) -t @IRC * $nick ( $+ $address $+ ) has left $networkname $+ / $+ $chan
on *:QUIT: echo $color(quit text) -t @IRC * $nick ( $+ $address $+ ) has quit $networkname ( $+ $strip($1-,m) $+ $chr(15) $+ )
on *:RAWMODE:#: echo $color(mode text) -t @IRC * $nick sets mode on $networkname $+ / $+ $chan $+ : $1-
on *:TOPIC:#: echo $color(topic text) -t @IRC * $nick changes topic on $networkname $+ / $+ $chan to ' $+ $strip($1-,m) $+ $chr(15) $+ '
raw 331:*: echo $color(topic text) -t @IRC * No topic is set
raw 332:*: echo $color(topic text) -t @IRC * Topic for $networkname $+ / $+ $chan is ' $+ $strip($1-,m) $+ $chr(15) $+ '
raw 333:*: echo $color(topic text) -t @IRC * Set by $3 on $asctime($4)
on *:KICK:#: echo $color(kick text) -t @IRC * $knick was kicked by $nick on $networkname $+ / $+ $chan ( $+ $strip($1-,m) $+ $chr(15) $+ )
on *:NICK: echo $color(nick text) -t @IRC * $nick is now known as $newnick on $networkname

Last updated 2003-04-05, Janne 'Geetee' Nikula, jn-mirc@zkelvin.net