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.

Example of a simple alias file

People usually begin scripting by creating simple aliases. Often that's all the "scripting" they will ever do. That's understandable because normal people don't usually need any scripts in the first place. Simple aliases are so simple to do that any computer literate person should be able to customize them for their own needs.

Creating aliases is very easy. You can write them to Tools/Aliases and Tools/Remote. When you write them to Tools/Aliases, the syntax is:
<alias name> <command>
If you decide to write them to the remote section, you need the alias prefix. The syntax is then:
alias <alias name> <commands>
Note that you don't need the slash in front of alias names or commands. The slash is required only when you type commands in the command-line.

If you write '/myalias fun rain boring', /myalias will have three parameters. The first parameter can be accessed with $1, the second with $2, the third with $3 etc. $2- means "the second parameter and everything after it". This naturally means that $1- will have all the parameters. There is also $0 which has the number of parameters. If you write the parameter with two dollar symbols, like $$1, it means that the alias won't run if the user didn't supply the parameter. So when we look at the example command (/myalias fun rain boring), the identifiers look like this:
$0 equals to 3
$1 equals to fun
$2 equals to rain
$3 equals to boring
$4 is empty
$1- equals to fun rain boring
$2- equals to rain boring
$3- equals to boring
$4- is empty

Here are a few practical aliases. They are very simple while being very useful at the same time. Many of them contradict with the aliases of the default installation. It's up for the user to decide whether you want to use the default ones or the alternatives presented here.

Example script

; General purpose

; List all the nicks in the channel
; Usage: /n <server> (the server parameter is optional)
n names $$chan $1

; List all the nicks in the channel with more info (full address and real name)
; Usage: /w
w who $$chan

; Close the current channel/query/DCC chat
; Usage: /c
c {
  if ( $query($active) ) close -m $active
  elseif ( $chat($active) ) close -c $active
  elseif ( $active ischan ) part $active
}


; Channel operator commands

; List the topic of the channel or set a new topic
; Usage: /t <new topic> (new topic is optional)
t topic $$chan $1-

; List the modes of the channel or set new modes
; Usage: /m <new modes> (new modes are optional)
m mode $$chan $1-

; Invite someone to the active channel
; Usage: /i <nick>
i invite $$1 $$chan

; Kick someone
; Usage: /k <nick> <reason> (the reason is optional)
k kick $$chan $$1 $2-

; Kick and ban someone
; Usage: /kb <nick> <reason> (the reason is optional)
kb {
  kick $$chan $$1 $2-
  ban $$chan $$1 3
}

; Knockout someone (kick and ban for five minutes)
; Usage: /kn <nick> <reason>
kn {
  kick $$chan $$1 $2-
  ban -u300 $$chan $$1 3
}

; List the channel bans
; Usage: /banlist
banlist mode $$chan +b


; Multiserver aliases

; Change nick on all servers
; Usage: /anick <new nick>
anick scon -a nick $$1

; Quit from all servers (but don't close mIRC)
; Usage: /aquit <reason> (the reason is optional)
aquit scon -at1 quit $1-

; Set away/back on all servers
; Usage: /aaway <reason> (sets away)
; Usage: /aaway (sets back)
aaway scon -at1 away $1-

; Send message to all channels on all servers
; Usage: aamsg <message>
aamsg scon -at1 amsg $$1-

; Send action to all channels on all servers
; Usage: aame <message>
aame scon -at1 ame $$1-


; Miscellaneous

; Say your computer uptime to the active channel/query/dcc chat
; Usage: /uptime
uptime say Uptime: $uptime(system,2)

; Search Google
; Usage: /google <keywords>
google url http://www.google.com/search?q= $+ $replace($1-,$chr(32),+)

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