mIRC Scripting
 Written by Xcalibre, touched up for our page by AMis (thanks Xcalibre!!!)
 

mIRC has 3 sections which can be "programmed" in some way:

Aliases Popups Remote
Creating aliases Users
String definations Commands
Identifiers Events
Flags
Variables
Raw
The best way to learn and understand the way these sections work is by studying them in consecutive order. Really! Please don't try to take a shortcut to the Remote sections before you really understand the Aliases and Popups. The lessons you'll learn from each are cumulative.

(A note for those familiar with ircii: mIRC's aliasing syntax is similar to ircii's, but not exactly the same. mIRC's Remote Command and Event sections allow you to implement many of the same things you can do with ircii scripting, but the structure and syntax are a bit different.)

The Aliases section.

Under Tools/Aliases... the Aliases section will be found.

In this section you can define shortcuts for often-used commands such as join, part, quit, opping and deopping, and whatever else you want. Even things you frequently say can be placed in an alias... In general, ALL commands which can be used in the edit box (the line or lines you normally use to talk/type in) can be used in an alias. Aliases can also be used to execute several commands at once. You can even define aliases that are launched by the function keys F1 - F12.... (Finally some use for those never touched keys..)
In mIRC you can even call an alias from popup menu's and remote lines.

Creating Aliases.

OK, let's start right off the bat with an example. To join a channel, you normally have to type:

/join #{name}

...where #{name} is the name of the channel, of course. Since this command is used so often, it'd be nice to use it by typing as little as possible, right? So let's create an alias for "/join #{name}" -- let's create a shortcut.

Instead of typing "/join #{name}", let's make it so that we can type "/j #{name}" with the same results.

In that case, the Alias would be:

/j /join $1

(You don't have to understand exactly what that means to mIRC at this point, just what it will do. I'll explain the alias syntax shortly.)

Give it a try by placing the line "/j /join $1" in the Aliases list under Tools/Aliases (if it isn't already there). Then try it out on the command line (where you normally type) with a simple command like:
"/j #test".

You'll see that "/j #test" now does exactly the same thing as "/join #test" -- it joins you to a channel named #test. This construction is called an alias.

Alias Syntax.

Aliases use the following format: "/{aliasname} /{command}"

In other words, first your "shortcut" name (like "/j" in the example above), then a space, and then the actual command your shortcut is pointing to (like "/join" in the example above).

But it doesn't stop there. Aliases also use a number of special STRINGS. There are three pre-defined strings (#, $me and $! ) which always mean the same thing to mIRC (new predefined strings are the $read [-l#] and $url .... I'll discuss them later too.), and then several variable strings (such as $1, *1, $$1, $?, #$1, #$$1, and even #$?).

Don't worry, we'll explain all of these in good time.

Right now, let's concentrate on $1. After all, that's the string we used in our example above:

/j /join $1

$1 means "the first word typed after the Alias, whatever that may be." So if you type "/j #test", mIRC knows that this is a shortcut for "/join #test". If you type "/j #hello", it will know that this is a shortcut for "/join #hello".

Example: Multiple Commands

Now, let's say that you'd like to join several channels at once. You can make an alias to do this. Just separate the commands with the | character (on most keyboards, this is the shifted version of the \ backslash key)...

Let's say that you'd like to be able to type "/j3" and then follow it with the names of three channels, and they'll all be joined at once. The alias would be:

/j3 /join $1 | /join $2 | /join $3

So if you placed this alias in Tools/Aliases and you were to type:

/j3 #test1 #test2 #test3

...mIRC would "/join #test1", then "/join #test2", and then "/join #test3".

In this case, you see that $1 means the first word typed after the Alias. And $2 of course means the second word, and $3 the third.

Now, mIRC is obviously expecting three words -- your channel names. So what would happen if you just typed "/j3 #test1"? mIRC would complain about the missing parameters, as it's expecting more channels to be named. There is a solution to this problem, the $$1 string, which will be explained later.)

Example: /say

Let's say that there's something you find yourself typing into a channel all the time, like your home page address, a greeting, etc.

Take a look at these alias examples using the "/say" command: "/say" simply types the indicated text into your current channel or private message window.

(On some systems, you may need to scroll to the right to see the full text of these and other examples.)

/hello /say Hello to all of you...

/www /say The mIRC page is at http://metro.turnpike.net/mookies/mirc.html

/lines /say This is the first line | /say This is the second line | /say This is the last line

The last examples show how to /say multiple lines of text in one alias. Just separate the commands with the | character. You also see that not all aliases always have Strings in them.

Example: /me

Actions in an alias...

/fun /me thinks this is fun!
/hug /me hugs $1 firmly!

The second example uses a string, $1. If you were to type "/hug everybody", this would be equivalent to "/me hugs everybody firmly!"

Example: Shared Strings

Multiple commands can also share the same string.

/jtest /join $1 | /topic $1 just testing

In this alias definition the parameter $1 is used twice. If you were to type "/jtest #test", it would first join the channel #test, and then change the channel topic to "just testing."

Another example along the same lines:

/love /say I love $1 ! | /say I really love $1 !!

If you were to type "/love everybody", mIRC would know to "/say I love everybody !" and then, "/say I really love everybody !!"

Example: Mode Changes (Opping, etc.)

To put your often-used mode changes in the aliases section, you first need to know the normal structure of the mode commands. Opping somebody on IRC normally requires the command:

/mode #{channelname} +ooo {nick1} {nick2} {nick3}

...in which up to 3 persons can be mentioned.

This can be nicely aliased with:

/op /mode # +ooo $1 $2 $3

To op John, Jake, and Joan, now you can just type: "/op John Jake Joan"

The # in this alias shows the use of one of the other pre-defined strings (# and $!). The # always stands for the #channelname of the channel on which the alias is used....

In the same way you can make aliases like...

/deop /mode # -ooo $1 $2 $3
/ban /mode # +b $1
/kick /kick # $1
/dbk /mode # -o $1 | /kick # $1 | /mode # +b $1

IMPORTANT: Proper spacing!

This is very important! You MUST include spaces between strings and the rest of your text! For example:

/like /say I really like $1!!!

...will NOT work! There needs to be a space between the string "$1" and your "!!!"'s. (This can sometimes make your text look awkward when using commands like /say, so be careful with your phrasing.)

/like /say I really like $1 !!!

...WILL work just fine.

This is true of ALL strings. To make one particular case easier, specifying channels, a few special strings have been created that automatically prefix the parameter with the # character. These are #$1, #$$1, and #$?. See below for details.

In SOME cases you CAN do: /like /say I really like $1's topic,
but keep in mind: NOT ALWAYS !! You have to test this in every case you want to use it...

Where can you use Aliases?

Aliases can be used in the edit box (the line or lines you normally use to type commands in), and you can even use aliases in the Popups and the Remote sections that will be explained in the following sections. The function key aliases can also be used on selected nicks in the channel names-list and in query windows, etc....depending on your alias definitions. It is even allowed for aliases to call other aliases, or even to call themselves recursively. As a safeguard against infinite loops, the default maximum recurse depth is set at 5. This can be changed with the /maxdepth command. The minimum depth allowed is 1 (aliases can't call other aliases) and the maximum is 100. Calling aliases from within aliases uses quite a bit of memory, so this might cause problems in certain situations where memory is low etc. In case one of your aliases or remotes got into a loop use the CTRL+Break key combination to stop the process.

Special Alias Definitions ; The Function keys.

A special alias definition is possible which can launch commands using the Function keys. Define some aliases as follows:
/f1 /say Hello to you all
/f2 /topic # This is a new topic

You now can type "/f1" to say hello to all on a channel ... but pressing the "F1" function will also work !! Other examples:
/f5 /me will happily send you the new mIRC.
/f6 /join #mirc
/f9 /dcc send $1 c:\serve\mircfq18.zip
/f10 /dcc send $1 c:\serve\mirc364.zip
/f11 /dcc send $1

The F9 key will send the mIRC FAQ to a person selected from the channel names list. Don't forget to select a nick first ! If you don't, you will see strange (but logical) things... You can even use the F9 key in a Private, Query or DCC Chat window with this alias definition !
The F11 key will prompt you for the nick to whom to send a file...
Well.... invent your own custom use of the F keys ..... have fun ! You can also use -shift- and -ctrl- in combination with the F keys. Just define aliases like :
/f1 /say I used F1 to say this
/sf1 /say I used Shift+F1 to say this
/cf1 /say I used CTRL+F1 to say this

Using evaluation brackets.

You can now use [ and ] evaluation brackets in aliases to control the order of evaluation of identifiers. The brackets can be uses in popups and remotes as well. Identifiers within brackets will be evaluated first, from left to right. You can also nest brackets. This allows you to evaluate things any way you like... The brackets will not show in the resulting text or command. Example's are :
/note /notice $1 " $+ [ $read [ -s + [ $2 ] ] c:\text\note.txt ] $+ "
/sayvar /say % [ $+ [ $1 ] ]

Definitions without evaluation brackets are evaluated the same way as before.

String Definitions.

By now, you should have a decent grasp of the Aliases section. You might be interested in a full list of the strings and identifiers that you can use in your aliases and, later on, in popups and remote definitions as well, by now? The next two sections will introduce them all. At this point, make sure to try all of the examples given until you fully understand how to do it yourselves!

$1

*1 $$1 $? $?="text" $! #$1 -and- #$$1 -and- #$?

Identifiers.

# $me $read [-l#] {filename.txt} $readini {inifile} {section} {item} $url $ip Your IP Address.
$server The server you use.
$active The name of the active window in mIRC.
$time The time on your PC.
$away Tells you if you're set away or not.
$ticks Returns the number of ticks since your O/S was first started.
$idle Returns same idle time as that returned by ctcp userinfo and finger.
$online Returns the number of seconds elapsed on your online timer.
$ctime The number of seconds elapsed since 00:00:00 GMT, January 1, 1970.
$asctime(N) Returns ctime values in a full date text format.
$day The current day. (Monday, Tuesday,...)
$date The date (european order) (YES !! mIRC is -not- made in the USA ;o) alternatively use $adate (american), $fulldate or $day.
$duration(seconds) Translates numbers like 123456 into 1day 10hrs 17mins 36secs.
$logdir, $getdir, $wavedir, $mircdir Return the paths to these directories.
$nopath(filename) Returns only the filename with no path.
$nofile(filename) Strips the filename and returns the remaining path.
$exists(filename) Checks if the given filename exists. (Returning $true or $false)
$findfile(dir,filename,N) searches the specified directory tree for the Nth specified file.

 $abs(N) returns the absolute value of number N.
$chr(N) returns the character with ascii number N.
$asc(C) returns the ascii number of the character C.
$len(text) returns the length of "text".
$upper(text) returns "text" in uppercase.
$lower(text) returns "text" in lowercase.
$left(N,text) returns the left N characters of 'text'.
$right(N,text) returns the right N characters of 'text'.
$mid(S,N,text) returns N characters out of 'text' starting at S.
$pos(string,substring) returns the position of substring in string.
$replace(string,substring,replacement) replaces a substring in a string.
$remove(string,substring) removes a substring from a string.
$strip(text) Strips out all bold, underline, reverse, and colour control codes from text.
$count(string1,string2) returns the number of times string2 occurs in string1.
$str(N,text) returns "text" repeated N times.
$rand(X,Y) returns a random char inbetween X and Y.
$lines(file) returns the number of lines in the specified file.

 $usermode Returns your current personal mode.
$topic(#) returns the topic of channels which you're currently on.

 $nick(N,#) returns Nth nickname on channel #.
$snick(N,#) returns Nth selected nickname on channel #.
$opnick(N,#) returns Nth Op nickname on channel #.
$nopnick(N,#) returns Nth non-Op nickname on channel #.
$vnick(N,#) returns the Nth voiced nick on a channel.
$nvnick(N,#) returns the Nth non-op/non-voice nick on a channel.
$query(N) returns the Nth query window you have open.
$chat(N) returns the nick of the Nth dcc chat window you have open.
$fserv(N) returns the nick of the Nth file server window you have open.
$send(N) and $get(N) return the nick of the Nth open send/get window.
$notify(N) returns the Nth notify nick currently on IRC.
$token(N,C,text) returns the Nth token in 'text' separated by character C (C is the ascii number of a character)
$addtok(text,token,C) adds a token to the end of text but only if it's not already in text.
$findtok(text,token,C) returns Nth position of token in text.
$gettok(text,N,C) returns Nth token in text.
$instok(text,token,N,C) inserts token into Nth position in text even if it already exists in text.
$remtok(text,token,C) removes 1 matching token from text.
$reptok(text,token,new,C) replaces 1 matching token with new token in text.

 For the above identifiers you can specify N as 0 (zero) to get the total number of nicks/channels/etc. for that identifier.

 $snotify returns the nick currently selected in the notify window.
$address returns the full address of the user that triggered a remote line.
$address(nickname,type) which scans the internal address list and returns a users address if it's found.
$maddress returns the currently matched user address for an event in the remotes.
$level(address) finds a matching address in the remote users list and returns its level.
$ulevel returns the remote user levels that matched for an event.
$clevel returns the remote command levels that matched for an event.
$dlevel returns the remote default user level.
$mask(address,type) returns the address with the specified mask type.

 Identifiers and variables can be placed inside the brackets.
Example: /echo $right(3,$left($len(goats),ToMooOrNotToMoo)) results in ' Moo'

 Identifiers with properties.

Several identifiers can be used with special parameters attached. This eases up remembering their syntax and might help a lot in scriping. The syntax is $identifier(N|#|nick).property

$server(N) Gives access to the servers list under File/Setup/IRC_Servers.
$server(N) for the address, .desc for the description, .port for the port, .group for the group.
$ial(mask,N) Gives access to the Internal Address List.
$ial(mask,N) for the full address, .nick for the nick, .user for the user, .host for the host, .addr for the address.
$url(N) Gives access to the urls list.
$url(N) for the address, .desc for the description, .group for the prefix
$chan(N/#).property Returns several 'channel' settings of channels which you're currently on.
$chan(N/#) returns channel name, .topic, .mode, .key, .limit,
$chat(N) nickname, .ip, .status (active, waiting, inactive)
$fserv(N) nickname, .ip, .status, .cd (current directory)
$get(N) nickname, .ip, .status, .file, .size, .rcvd, .cps, .pc
$send(N) nickname, .ip, .status, .file, .size, .sent, .lra, .cps, .pc
$timer(N) Returns the timers you've active
$timer(N) for the id, .com, .time, .reps, .delay, .type

 User-definable identifiers. (Section originally written by Li0nheart)

 As you just learned mIRC has a large number of built-in identifiers that you can use in your alias and remote definitions. It is also possible to make your own identifiers, and they can be configured to do virtually whatever you want! The identifiers are programmed in the alias section, and look exactly the same as an alias, with the only exception that at the end there is a /return X. You can have the identifier return whatever you want. For example, the sum of two numbers:
/sum {
%temp = $1 + $2
return %temp
}

 Now you can use the $sum identier anywhere in aliases, popups, or remote. For example in the popup item:
Add:/say The sum of 45 and 78 is $sum(45,78)
Or the Alias:
/add /say The sum of $1 and $2 is $sum($1,$2)
(btw. it makes no sense to give a command like /sum .. that wont work)

 All parameters given to the identifier are seperated with commas. You can use all usuall if/then/else structures to in the identifier definitions. You could for instance check if all the required parameters are there, and return an Error command instead. For example, this routine that calculates what percentage X is of Y.

 /perc {
if ($1 == $null) || ($2 == $null) { return Error not enough parameters }
if ($2 != 1) { %half = $2 / 2 } | else { %half = 1 }
%dummy = $1 * 100
%perc = %dummy / $2
%remainder = %dummy % $2
if (%perc == 0) { goto return }
elseif (%remainder >= %half) { inc %perc }
:return
return %perc
}

 The first line makes sure all the parameters are there. The rest is calculation of the percentage, where part of it is used to make sure the total adds up to 100%. The identifier would be called with, for example, $perc(56,100) which would display 56% Numbers aren't the only thing you can return with an identifier. You can also make it return text, or combinations of text and numbers, for example, the time in american format (7:52 pm):
/atime {
set %hr $token(1,58,$time)
set %min $token(2,58,$time)
if (%hr == 0) { set %hr 12 | set %sub am }
elseif (%hr < 12) { set %sub am }
elseif (%hr == 12) { set %sub pm }
else { %hr = %hr - 12 | set %sub pm }
return %hr $+ : $+ %min $+ %sub
}

 With a little creativity you can make identifiers for anything you want. For example, backwards talking, or highlighting every other letter. Have fun!

The Popups section.

Popups are the menus that appear when you right-click with your mouse. If you haven't found this nice feature of mIRC already, give it a try NOW! Some popup menu's are predefined in the mIRC.ini from the mirc.zip-file, but they are fully customizable under Tools/Popups. If your copy of mIRC doesn't seem to be equipped with some prefab popup menu's (the Tools/Popups section is empty then), it is almost certain that you didn't make sure that the prefab popups.ini file was correctly copied from the mirc.zip to the mirc directory, or the path to where this prefab popups.ini can be found is not correctly specified.

The popup commands work almost exactly like aliases. All of the strings mentioned in Section 7-1 are allowed in popups (and vital for the proper use of them). If you haven't read the Aliases section (7-1), please do so now! You need to know that information before moving on.

Also: Definitely read the Help file's explanation of popups, as well as take a look at the many popup examples included in mIRC under Tools/Popups. The more examples you try, examine, and mess around with, the better your grasp of mIRC will be.

Example: /join

Let's say that you join a particular channel frequently, #test.

Rather than having to type in "/join #test", wouldn't it be easier to just right-click and select a menu item to join you there automatically?

The following popup would do that. Just enter it into Tools/Popups, making sure that "Main Window" is selected at the top. (Not Query/Chat window, Channel Names List or Menu Bar!)

Join the Test Channel:/join #test

Now right-click over your Status window or any channel window and select "Join the Test Channel". mIRC will do exactly that.

Example: /away

Here's an example of "away" and "back" popups... you type in the reason you're away, and it's sent to all the channels you're on. (That's what the /ame command does, it sends a /me to every channel you're on.)

Set Away...:/ame is AWAY ( $?="Give a reason" ) | /away Please try later ( $! ) !!
Set Back:/ame is BACK | /away

(Note again that on some systems you may need to scroll to the right to see the full text of some examples.)

Notice that the "Set Away" example uses multiple commands.

Heirarchal Menus

If you were to add a few popups like that, your screen would quickly get cluttered every time you right-click. So you can organize your popups into heirarchal menus.

Try entering all of the following popups:

Say Things
.Hello:/say Hello folks
.Goodbye:/say Goodbye folks
.Hug Somebody:/me gives $? a big hug

Here we're specifying that the last three commands should show up _under_ "Say Things" by: 1) including them after "Say Things", in the order we want them to appear, and 2) prefacing them all with "." <-- a period.

When you right-click, you'll see the "Say Things" menu item. When you select that, you'll see "Hello", "Goodbye", and "Hug Somebody" menu items. Select from those to perform one of the actions specified above.

If you want to get really complicated, you can make your popups many levels deep. For example, try:

Comment About People
.Compliments
..Nice Today:/say Wow, $? -- you're being very nice today!
..Helpful:/say Thanks for being so helpful, $?
..Friend:/say I'm glad to have $? for a friend.
.Insults
..Jerk:/say Leave me alone, jerk!
..Idiot:/me wonders why $? is such an idiot sometimes.
..Enemy:/say I'm proud to have $? as my enemy!

And so on! Just order them properly, using the periods. (If the manner in which the above is organized doesn't "click" with you, definitely try it out! Enter the above "comment" section into Tools/Popups. It's a lot easier to grasp when you see it working.)

All popup menu items can be put under a Function key too! That's handy as a replacement for often-used popups.... (Make sure to use the correct syntax and put them [ie.the function key replacements] in the alias section)

The Remote Section.

The Remote section can be found under Tools/Remote/. Clearly the most advanced part of mIRC, you can do things with mIRC's Remote section that would normally require scripting or special bot software...

Things like: offering files (an XDCC list); responding to specific channel or private message text; customizing CTCP responses; setting up various user levels for your friends; ...almost anything that happens on IRC can be automatically responded to, and your response can make use of almost any mIRC command or commands.

The Remote syntax can be a bit complicated at times, but it's a simple extension of the formats explained previously for Aliases and Popups. If you understand those well, including the Strings, then please proceed. If not, go back and read (or re-read) Sections 7-1 and 7-2. The information presented there is ABSOLUTELY REQUIRED LEARNING before attempting Remote.

It's also important to remember why Remote is called Remote. The Remote section is designed to respond to things done by users OTHER than yourself -- in effect, it allows others to "remotely control" your mIRC session, according to the specific Remote features you implement. Many examples can't be tested by simply sending the commands or typing the text yourself. They have to be sent by some other client.

Remote consists of three parts: Remote Users (the user list), Remote Commands, and Remote Events.

Remote Users.

(Also please read section 6-7.)

See Tools/Remote, the box at the top left labeled "Users"...

In this part of Remote you can assign various user levels. You can assign certain levels to your friends and certain levels to your "enemies", and a host of levels in between.

Why is this important? Let's say that you've written a Remote Event designed to kick anyone who says the word "nonsense" in your channel (just replace this in your head with whatever foul word you'd like). We'll explain how to do this later (in Section 7-3-3), but for now it's just the idea that's important. Sounds reasonable, right?

OK, but perhaps you'd ONLY like regular users to be kicked for saying "nonsense." You'd like some of your friends only to be warned. And you'd like to ignore it from still others, perhaps your closest friends. And if you don't care for someone much at all, perhaps you'd like to kick AND ban them for saying "nonsense"!

To do these kinds of things (give different responses to different people), you need to setup a users list. For each user, you'll specify their nick or address and the user level you've decided to assign them.

Here's an example of a valid user list:

1:nick1
1:nick2
2:[email protected]
2:*[email protected]
3:*!*@machine.subnet.edu
4:*!*@*subnet.edu
5:*!account@*.subnet.edu
10:[email protected]

The numbers you pick for the user levels are completely up to you. You can decide what each of the user level numbers can and cannot do, as you'll see in the next two sections. By default, mIRC assigns everyone not specified in the user list to level 1. (Depending on the setting in Tools/Remote/'Default level'.

If you specified different levels to different users you of course also need commands and events that have different reactions or power to users of these levels... That will be explained later...

As you can see, either a nick or an address are permissible. Wildcards are allowed. There are some cases where you might want to specify your users twice, by both nick and address. This case (ON OP/ON DEOP/ON SERVEROP/ON NOTIFY) is explained in Section 7-3-3.

You don't have to do all the editing by hand ... you could also use mIRC's edit box or command line commands /auser, /guser and /ruser.

/auser /auser {level} {nick or address}
'Auser' (Add user) adds whatever nick or address you specify to the users list at the level you specify. It does not check for a valid address. The nick or address is added exactly as you stated it.

/guser /guser {level} {nick} [type]
'Guser' (Get user) adds a nick to the users list specified by address. To accomplish this mIRC does a /whois on the nick you specify, and adds the returned address at the specified level to the users list. This means that the specified nick has to be on IRC to be able to use the /guser command to add him/her to the list. By specifying the 'type' mIRC can add a user with several types of wildcarded addresses. This is analogous to the 'type' parameter used in the /ban command. Type ranges from 0 to 9.

/ruser /ruser {nick or nick! or address or nick [type]}
'Ruser' (Remove user) removes a nick or address from the Users list. You must know exactly how the nick or address is stated in the User list for this command to work.
If somebody is listed like [email protected] you can also do "/ruser nick!". Mind the "!" to remove the entire line.
In mIRC version 3.5 an improved /ruser command was made so that it can work like /ban and /guser. /ruser {nick} [type] if you do NOT specify a type, then it works as usual and removes the specified nick from the user list. If you DO specify a type, it looks up the users address and removes that address from the user list.

 Note: Using different address types allows you to specify a person or group of people with more or less wildcards. I'll show you the different results ..... If no type is mentioned type 6 is default; Kreet!*[email protected]
type 0; *[email protected]
type 1; *!*[email protected]
type 2; *!*@Wit399402.student.utwente.nl
type 3; *!*vonck@*.student.utwente.nl
type 4; *!*@*.student.utwente.nl
type 5; [email protected]
type 6; Kreet!*[email protected]
type 7; Kreet!*@Wit399402.student.utwente.nl
type 8; Kreet!*vonck@*.student.utwente.nl
type 9; Kreet!*@*.student.utwente.nl

A last remark; A user level can now even be a word, for example: mircop:*!*@mardam.demon.co.uk (You can use this with events like op:ON JOIN:#mirc:/mode $chan +o $nick)

 mIRC now keeps an internal database of the people on the channels you are on. This database is used to speed up the performance of commands like /ban, /guser and /ruser a whole lot. These commands normally will make mIRC do a /whois on the person you issue the command on. The internal list stores info like nick!user@address for all users that are on the same *channels* as you. Whenever a /guser, /ruser, /ban, /finger, /ignore or /dns command is issued, the internal list is searched first to find the nick's address. If no match is found, the normal /whois stuff is done. This will speed up your bans a lot...especially when you're lagged... If you are on a slow PC and/or you are on a lot of large channels, mIRC's updating of the database might slow you down quite a bit ... then its probably good to switch it off ! In the Tools/Remote dialog you can deselect the use of the 'Internal Address list'.

Remote Commands.

See Tools/Remote, the box at the bottom, with "Commands" selected...

Remote Commands refers to a very specific type of command: CTCP commands. The Remote Commands section of mIRC does one thing and one thing only -- it allows you to make mIRC respond to CTCP commands sent by other users the way -you- wish. There are a lot of ctcp commands defined according to the IRC RFC's (standards). The usual ones are version, ping, time, userinfo, clientinfo and finger. Every IRC client will respond in a standard way if one of these commands is send to it. These ctcp commands are sent by or to you in the format:

/ctcp {yournick} {command with parameter(s) if any}

Consider the simple example of a ping. The other user would type:

/ctcp {yournick} ping

(You can also send yourself a ping command! Try it! Type "/ctcp {yournick} ping".
Under normal circumstances, mIRC would send a standard ping reply [ctcp hisnick pong]. But with Remote Commands, you can redefine the program's response to the ping. It can now do almost whatever you'd like it to do when it receives a ping. On top of that, it can also send a normal ping reply. Or not. It's up to you.
There is ONE exception to this ... you cant hide your mIRC version reply.... We like the advertisement, you know....

You can also create new CTCP commands, and responses for them. This is how features like file offering (XDCC LISTs and SENDs) are handled.

But right now, let's get back to our ping example.

Example: Custom Ping Response

Place the following example into your Remote Commands. Go to Tools/Remote, make sure that "Commands" is selected, and "Listening" is checked, (When "Listening" is not checked, Remote Commands are ignored.) and write in the commands box:

1:ping:/notice $nick ping? Hmmm! ...pang pang pang!!

Now if someone pings you, your reply will be "ping? Hmmm ! ... pang pang pang !!" in a notice sent to the person who pinged you, and not the normal reply being 'pong'.
Test this by giving the command "/ctcp {yournick} ping"! If it doesn't work make sure your Remote/Commands section is set to 'Listening'! Or set it to active by the '/remote on' or '/commands on' command.
If you want mIRC to -not- give the default ping reply on top of your custom one you can block the default processing by the /halt command. Use it like
1:ping:/notice $nick ping? Hmmm! ...pang pang pang!! | /halt
This will do the same thing as before, except it will not send your normal ping reply. Again, test it and see the difference!

Assuming you actually tried the two given ping replies, and that you got them to work, let's go over the syntax used here a bit, and then we'll go back to the above example and _why_ it does what it does.

Remote Command Syntax.

Remote Commands, except for some special cases, are made up of 3 portions. Each of the portions are seperated by a colon. The general syntax looks like:

{command_level}:{ctcp_command}:{triggered_command(s) with parameter(s)}

Lets go over the separate portions one by one:

{command_level} This command will respond to users with a user level equal to the command level, and to users with higher levels, unless other commands are created for them.

{ctcp_command} The CTCP command can be named anything you want it to be. It can be a standard, already existing CTCP command, like Ping or Version, or it can be one of your own creation. (like OPME, DIE, LEAVE, XDCC LIST,......)

{triggered_command(s) with parameter(s)} In this part you define the (to be) triggered command(s). Their format and the use of multiple commands is almost exactly as you define them in the aliases and popups. The strings in this section are filled in by mIRC automatically... You only have to make sure that the strings you use are defined at all... ie. make sense if used in the remote commands ... (For instance the $chan is NOT defined in the remote commands !!)

Let's take a look at our ping example and try to dissect it.

1:ping:/notice $nick ping? Hmmm! ...pang pang pang!!

1 is the command level. All users with a user level equal or higher than 1 can execute or use this command.

Ping is the CTCP command this Remote Command is going to react to.

The triggered command is a /notice. In this case a notice is sent to $nick containing the entire line "ping? Hmmm! ... pang pang pang!!" $nick is a pre-defined parameter that contains the nick of the person who gave you the CTCP command ... in this case he pinged you. (More about the pre-defined parameters soon.)

Summarising, the effect of the command "/ctcp ping" is a "/notice {nick} ping? Hmmm! ...Pang pang pang!!" This is executed as soon a CTCP Ping is received.

You can also use multiple commands, utilizing the | character, as with Aliases and Popups. That way a single Remote Command could activate multiple command lines. The use of the | is very straight forward, and we'll cover it later. Just glue two remote commands together using the |.

Different reactions to people with different user levels

You can fine tune your reactions to remote commands by assigning different levels to them.
mIRC will always respond to a user with the highest leveled reply that fits to the command he/she gave.. Lets analyze it with these example lines...

1:ping:/notice $nick ping? Hmmmm your levels are tooooo low... | /halt
2:ping:/notice $nick ping? Hmmm! ...pang pang .... Quite dead !!
3:ping:/notice $nick ping? ...pang !! Hmmm... missed..
6:ping:/notice $nick ping? Hmmm! ...Well I like you .. you're allowed to ping me..

A level 1 user won't get a ping reply but a nice "ping? Hmmmm your levels are tooooo low..."
A level 2 user (2:[email protected]) will not survive it when he does a /ctcp ping ;o) He will see "ping? Hmmm! ...pang pang .... Quite dead !!"
A level 3 user (3:*!*@machine.subnet.edu) will get " ping? ...pang !! Hmmm... missed..."
To level 4 and 5 users no specific reaction is defined ... The highest to them available command is the level 3 one... Therefore these people (5:*!account@*.subnet.edu) will see the level 3 reaction too !!
Level 6 and higher users will all get the level 6 ping reply...

This leveling can be done for ALL remote commands (and events) ....
Make sure you get the point here !!! Maybe re-read the above sections ??

 Special identifiers for Remote/Commands/ lines.

 $nick, $address, $parms, $parm1, $parm2, $parm1*, $parm2* etc. are all identifiers specially created tobe used in remote lines.
You can use them whereever you want in the lines triggered by remote commands...

$nick The nick of the person who sent the command or activated the event.
$address The full address of the person who sent the command.
$site The site of the person who sent the command.
$level Represents the users remote level.
$parms Any text the person might've sent including (!) the command.
$parm1 Lets you break down $parms into individual words.
$parm3* Contains the third word in the command and all after it.

Note: The $chan is NOT ALWAYS DEFINED in the Remote Commands ... $chan normally contains the channel from which a commands is given ... CTCP commands don't have to be given to you from a channel ... or the person sending the command could be on more channels ... Get the point ?? Maybe $active will do what you want ?

Example: Here's an example using the pre-defined $address parameter...
1:address:/notice $nick Your address is $address
If a user were to send a '/ctcp {yournick} address' command to you, you would reply with a notice reading, "Your address is {whatever his or her address is}".

 Example: Opping friends on demand. (Using $parms)

If you're not clear on the basics of how all of this works yet, don't worry. Try to follow along with the examples and see if it "clicks" in your brain. Re-read the above examples if necessary. But don't attempt to write your own Remote Commands or move on to the next section until it "clicks."

1:opme:/notice $nick Sorry, you won't get opped on $parms .. your level is too low
5:opme:/mode $parms +o $nick

If a level 5 friend sends '/ctcp {yournick} opme {#channelname}', this command will op them in the specified channel. Level 1 people WON'T get opped whatever they try....

Here another predefined parameter is used -- $parms, which refers to everything the user typed after the CTCP command (opme). In this case, it's the channel name.
The $parms can be used to process long lines given by a remote user in a CTCP command...

5:return:/notice $nick $parms

This command for instance will return any sentence issued by a remote user. The entire line given by the remote user after the CTCP Return command will be held in the $parms parameter. This will be sent back to them in a notice.
A "/ctcp {yournick} return Bladiebla die bladie bla bla bla" will cause your mIRC to respond by executing the command "/notice friend Bladiebla die bladie bla bla bla".

Multiple Commands.

A Remote CTCP command can also trigger multiple commands....

5:opme:/mode $parms +o $nick | /notice $nick You are opped on $parms

Then your level 5 friend sends the command:
'/ctcp {yournick} opme #channelname'

What happens??
In effect two commands are triggered by the Remote CTCP opme command...
one "/mode #name +o friend"
two "/notice friend You are opped on #name"

Another CTCP command triggering multiple commands:

10:part:/part $parms | /notice $nick I have left channel $parms

And if a level 10 user sends you:
'/ctcp {yournick} part #channelname'

This command makes you leave a channel on request, and tells the requester you did so...

$parms contains the channel name you are asked to leave.
$nick is the nick of the person who asked.

*** Other Examples.

1:ping:/notice $nick Please don't ping me.

...would respond with: "/notice {nick} Please don't ping me."

5:time:/notice $nick Time to get a watch.

...would respond with: "/notice {nick} Time to get a watch.

10:whoareyou:/notice $nick I am who I say I am | /notice $nick And I say that I'm YOU!

...would respond with: "/notice {nick} I am who I say I am" followed by
"/notice {nick} And I say that I'm YOU!"

The Remote Events section.

See Tools/Remote, the box at the bottom, with "Events" selected...

As you've seen, Remote Commands only deal with CTCP commands. Remote Events deal with just about everything else that can happen on IRC.

If that sounds daunting, don't worry. As explained earlier, these lessons are cumulative. If you understand Remote Commands, Remote Events will be a piece of cake. You've already learned the really difficult stuff.

Warning: In general mIRC is very sensitive to poor Remote Event syntax. Using incorrect syntax can cause a GPF (General Protection Fault), so be careful! If ever you suddenly experience stability problems with mIRC, this is the part to check first!

Remote Event Syntax.

The Remote Events are: ON TEXT, ON JOIN, ON PART, ON KICK, ON OP, ON DEOP, ON INVITE, ON NICK, ON QUIT, ON TOPIC, ON SERVEROP, ON NOTIFY, ON MODE, ON SERVERMODE and ON SMODE. Besides ON TEXT the similar ON ACTION, ON NOTICE, ON SNOTICE, ON CHAT, ON SERV and ON WALLOPS are available for more specific text origins. New are the ON FILESENT and ON FILERCVD events as well as ON CHATOPEN, CHATCLOSE, SERVOPEN, SERVCLOSE and several others.

Exactly what they do, and how to use them, will be explained shortly. First, some quick examples and an explanation of the syntax used.

The syntax is essentially the same as with Remote Commands. Here's a sample Remote Event for ON TEXT:

1:ON TEXT:hello:#:/msg $nick Hello back!

Place that example into your Remote Events. Go to Tools/Remote, make sure that "Events" is selected (not commands), and "Listening" is checked. (When "Listening" is not checked, Remote Events and Commands are ignored.)

This Remote Event is triggered when the word "hello" is found in any active channel. mIRC's response is to send a private message to the person who wrote it, saying "Hello back."

Here's another example, this time using ON JOIN:

1:ON JOIN:#:/notice $nick You are very welcome to $chan

This one is triggered whenever a user joins a channel you're on. A notice is sent to them that says, "You are very welcome to {channelname}".

If you've made it this far, and understood Remote Commands, this should seem fairly simple to you.

Remote Events have either 3, 4 or 5 portions divided by colons. Most of the events have 4 portions, except for ON TEXT which has 5, and ON QUIT and ON NICK have only 3.

All of the events *except* for ON TEXT, ON QUIT and ON NICK are formatted like so:

{event_level}:{event}:{where}:{triggered_command(s) with parameter(s)}

{event_level} This event will effect users with this user level, and any higher levels, unless other event entries are created for them. Just like command_level in Remote Commands.

{event} The name of the event we're listening for. ON JOIN, ON OP, etc.

{where} #, #name. Where are we listening for this event? Either # (any channel) or the name of a specific channel (like #test).
EXCEPTION: Not used with ON NICK or ON QUIT. Then just skip this part.

{triggered_command(s) with parameter(s)} The (to be) triggered command. Just like in Remote Commands except that we have a few different pre-defined parameters.
...and of course, the big exceptions here are ON TEXT and ON ACTION which work like so:

{event_level}:{event}:{what_text}:{where}:{triggered_command(s) with parameter(s)}

{command_level} Same as above.

{event} Well, obviously, it's going to be ON TEXT or ON ACTION

{what_text} Specify the word or phrase to listen for. Like "hello" in the first example.

{where} #, #name, ?, *. Just like above, you can tell ON TEXT and ON ACTION to listen on all channels (#) or on a specific channel (like #test). But you can also tell it to listen to all of the private messages sent to you (?) or to both channel and private message text (*). An ON TEXT or ON ACTION event can't listen for things said in DCC Chats or Server messages.

{triggered_command(s) with paramerer(s)} Same as above.

The Events

Here are the various Remote Events that mIRC can respond to...
 

ON TEXT Occurs when specified words/phrases are found in a channel or private message. ON ACTION works just the same ...

Example:
1:ON TEXT:nonsense:#:/kick $chan $nick No nonsense!
This will look for the word "nonsense" in any channel and kick the user who said it.

Example:
1:ON TEXT:nonsense:#test:/kick $chan $nick | /notice $nick Hello $nick , you said 'nonsense' and that's not allowed on #test...

If the word "nonsense" is said in #test, the sayer is kicked (if you're 'op' on #test) and sent a notice: "Hello {nick} , you said 'nonsense' and that's not allowed on #test..."

Example:
5:ON TEXT:help:?:/notice $nick I wish I could help you, but I can't.

If it finds the word "help" in any of your private messages, it replies to the user,
"I wish I could help you, but I can't" in a notice.

You can specify wildcards in the text mIRC should react to:

* reacts to any text
word if a user said only (and exactly) this word the event will trigger. Exact match required.
word* if a user started a line with this word the event will trigger.
*word if a user ended any line with this word the event will trigger.
*word* if a user said this word or phrase anywhere the event will trigger.

Example:
5:ON TEXT:help:?:/notice $nick I wish I could help you, but I can't.

This event will only react to a call for help if the msg only contained the word help ... not if a line containing the word 'help' was sent to you...

Example:
5:ON TEXT:hello*:?:/notice $nick Hello to you too !

This event will only react to private message lines sent to you starting with the word 'hello'.

ON ACTION See ON TEXT .... it works exactly the same....

ON NOTICE See ON TEXT .... it works exactly the same....

ON CHAT Works like ON TEXT but listens to a DCC Chat text.

Example:
ON CHAT:blabla:/msg $me $nick said $parms to you in a DCC Chat.

ON SERV Works like ON CHAT but listens to DCC Fileserver text.

Example:
* ON SERV:get mirc:/echo server 6 To $nick the mIRC zip is sent.

ON JOIN Occurs when a user joins a channel.

Example:
1:ON JOIN:#test:/notice $nick Welcome to the #test channel!
Sends a notice saying "Welcome to the #test channel!" to anyone who joins #test.

Example:
25:ON JOIN:#cool:/kick $chan $nick You're not welcome here!
Kicks any level 25 user who joins #cool with the message, "You're not welcome here!"

ON PART Occurs when a user leaves a channel.

Example:
10:ON PART:#:/notice $nick Hey, thanks for stopping by $chan !
Sends a notice saying, "Hey, thanks for stopping by {channel} !" to any level 10 who leaves a channel you're on.

Example:
90:ON PART:#:/msg $chan Yahoo! $nick is gone! Sends a message to the channel saying, "Yahoo, {nick} is gone!" if any level 90 leaves a channel you're on.

ON KICK Occurs when a user is kicked from a channel.

Example:
100:ON KICK:#:/kick $chan $nick | /invite $knick $chan | /notice $nick That person is my friend!
If any level 100 person is kicked from any channel, you kick the kicker off the channel, invite the kicked person back and send "That person is my friend!" to the kicker.
NOTE: $knick is the parameter for the kicked nick in this event. Also note that this example shows multiple commands. It works just like in Remote Commands.

ON OP Occurs when a user is opped.

Note: This event requires people to be mentioned by NICK in your Remote/Users list !

Example:
1:ON OP:#test:/notice $opnick You were opped by $nick . Welcome!
If someone is opped on #test, they're sent a notice: "You were opped by {opper}.
Welcome!"
NOTE: $opnick is the parameter for the opped user's nick in this event.

ON DEOP Occurs when a user is deopped.

Note: This event requires people to be mentioned by NICK in your Remote/Users list !

Example:
1:ON DEOP:#:/msg $opnick Tough luck. You were deopped by $nick
If someone is deopped, they're sent a message: "Tough luck. You were deopped by {deopper}.
NOTE: $opnick is the parameter for the deopped user's nick in this event.

NOTE
Explaining the ON OP, ON DEOP, ON SERVEROP as well as the ON NOTIFY event an important remark should be made. Due to the fact that servers only report the nick's of the people who are opped, deopped or notified on a channel or IRC, the ON OP, ON DEOP, ON SERVEROP and ON NOTIFY events only work properly if the nicks of the people who are opped, de-opped or notified are mentioned in the Users list. Specifying even the full address ([email protected]) is NOT enough... mIRC won't distillate the nick from such a statement. The only exception to this is if you wish the event to affect everyone by giving it an access level of 1, or whatever you have set the default user level to. This is the only case where it is not necessary to have a user in your User list by nick.

If you want to give people a level fitting to your ON OP, ON DEOP, ON SERVEROP or ON NOTIFY events you have to put them in your Users list by nick, like:

3:friendasnick
5:friendbsnick
5:friendcsnick
10:[email protected]

This construction can give you a good reason to specify people in your Users list by both their full address (wildcards are permitted) and their nick. This could then guarantee the proper reaction to an ON OP ON DEOP or ON SERVEROP without giving ALL people around with by accident (?) the same nick the same rights as your friends (or enemies).

ON BAN
ON UNBANWith the ON BAN you can easily auto-unban your friends.

Example:
5:ON BAN:#tree:/mode $chan -b $banmask
The $banmask will contain th

ON INVITE Occurs when you are invited to a channel.

Example:
5:ON INVITE:#test:/join $chan | /describe $chan thanks you for inviting him!
If invited to #test, join the channel and use an action to say "{me} thanks you for inviting him!"

ON NICK Occurs when a user changes his or her nick.

Example:
1:ON NICK:/notice $newnick I thought $nick was a nicer nickname!
Send a notice to anyone who changes nicks, "I though {your old nick} was a nicer nickname!"
NOTE: $nick is the parameter for the old nick, and $newnick for the (guess what?) new nick.
NOTE: The {where} portion is not used in ON NICK.

ON QUIT Occurs when a user quits IRC.

Example:
2:ON QUIT:/notice $me Time to party! $nick just quit the IRC!
Whenever someone quits, send a notice to yourself: "Time to party! {Nick} just quit the IRC!"
NOTE: The {where} portion is not used in ON QUIT.

ON TOPIC Occurs when a channel's topic is changed.

Example:
1:ON TOPIC:#:/msg $chan Wow, I love the new topic!
Whenever a channel topic changes, sends a message to the channel saying, "Wow, I love the new topic!"

ON SERVEROP Occurs when a server gives operator status (back) to a user on a channel.

Note: This event requires people to be mentioned by NICK in your Remote/Users list !

Example:
1:ON SERVEROP:#mirc:/mode $chan -o $nick | /notice $opnick Sorry, serverops not allowed on $chan
Whenever a person is opped on #mirc by a server, the opped person is deopped and receives a notice "Sorry, serverops not allowed on #mirc" Serverops normally occur after a netjoin when the two splitted nets exchange and update all current channel modes.

ON NOTIFY This event triggers as soon as people in your notify list join IRC.

Note: This event requires people to be mentioned by NICK in your Remote/Users list !

You could use this event to do a /whois on the notified nick to make sure it is the correct guy.... Remember that this event ONLY works on nicks mentioned in the remote/user list by NICK.... (like ON OP, ON DEOP and ON SERVEROP) This is due to the IRC protocols which don't pass through the address of the notified person...

Examples:
1:ON NOTIFY:/notice $nick If you are the real $nick then please join #mine !
3:ON NOTIFY:/whois $nick
5:ON NOTIFY:/beep 10 50 | /whois $nick

ON MODE
ON SERVERMODE These events can force a certain set of channel modes.

Use this event to make sure that when someone changes the channel modes, mIRC enforces the channel modes YOU want instead.

Syntax and examples :
1!:ON MODE:#name:-spmi+tnlk 20 mykey:/notice $nick illegal $chan
mode change!
1!:ON SERVERMODE:#name:-spmi+tnlk 20 mykey:/notice $me illegal
$chan mode change by server !

The ON MODE's react to any channel mode change, so there is no way to react to specific mode changes. This structure is certainly not perfect but it works...
Popular settings are :
1!:ON MODE:#mirc:-spmilk+tn:/notice $nick illegal $chan mode change!
1!:ON SERVERMODE:#mirc:-spmilk+tn:/notice $me illegal mode change!

Keep in mind that if you allow a higher level person to change mode settings without you reacting, lower level users can mess that up ! As soon as they change a mode (or the server does) then the forced modes are set; mIRC does NOT keep in mind that part of the new modes might be set by higher level persons ... Also beware of loops of more people on a channel forcing mis-matching modes !!

ON VOICE
ON DEVOICEThese events react to people getting or loosing voice on channels. Examples:
1:ON VOICE:/notice $nick Welcome in the speaking world!
1:ON DEVOICE:/notice $vnick Hey, $nick is allowed to speak here!

ON SNOTICE This event listens for server notices. Server notices tell you all kind of things happening at and with the IRC server you use. To recieve them you have to set your user mode to +s (/mode #nickname +s). Most people don't need this setting... It is mostly meant for IRCOps and server maintainers. With this event you can filter the server notices send to you and you can filter them ie. prevent them from being displayed or automatically react to them. The event syntax is very much like the ON TEXT event...
1:ON SNOTICE:servers_text:/echo 6 status The server noticed you about $parms

ON FILESENT This event will react to all successful DCC Send file transers. You can use it to send you or the reciever a small message...
1:ON FILESENT:*.txt,*.ini:/echo Sent $filename to $nick ( $+ $address $+ )
1:ON FILESENT:mirc4516.exe:/notice $nick Have fun with the 16 bit mIRC
1:ON FILESENT:mirc4532.exe:/notice $nick Have fun with the 32 bit mIRC

ON FILERCVD This event will react to all successful DCC Get file transers. It will trigger as soon as a file is succesfully retrieved to your harddisk. You can use it to send you or the sender a small message, or to start a helper application to view the recieved picture, play a sound file or read the text.
1:ON FILERCVD:*.txt,*.ini:/run notepad.exe $filename
1:ON FILERCVD:*.wav:/wavplay $filename
1:ON FILERCVD:*.gif:/run c:\windows\wingif\wingif.exe $filename
1:ON FILERCVD:*.jpg:/run c:\windows\lview\lviewp19.exe $filename
1:ON FILERCVD:*.mid,*.voc:/run wplany.exe $filename
1:ON FILERCVD:*.*:/notice $nick Thanks for the file!

ON CTCPREPLY Listen for replies to ctcps. eg.:
1:ON CTCPREPLY:PING*:/echo $active Got ping reply from $nick
1:ON CTCPREPLY:*mirc*:/echo $active Wow $nick uses mIRC too!

Special identifiers for Remote/Events/ lines.

 $nick, $address, $site etc. are all identifiers specially created tobe used in remote lines. You can use them whereever you want in the lines triggered by remote events...

$nick The nick of the person who sent the command or activated the event.
$address The full address of the person who sent the command.
$site The site of the person who sent the command.
$level Represents the users remote level.
$chan The channel on which some event triggered a Remote/Events line.
$parms Any text in the line that triggered the event.
$parm1 Lets you break down $parms into individual words.
$parm3* Contains the third word and all after it.

Various flags you can use in front of Command or Event lines in Remote.

Finally some remarks have to be made about the various flags you can use in the Remote section. (With Commands and/or Events)

*** The ! flag. (Events only)

This flag causes events not to be triggered by things you do yourselves.... .... mIRC will not react to things said or done from clients with your address. (A similar flag is the 'me' flag..which makes sure things wont be triggered by the IRC client -you- use. ie. it will react to any other IRC clients you may be running simultaneously)

Example:
1!:ON JOIN:#mine:/notice $nick Welcome here.
This will not react to you joining #mine ....everybody else will get the Welcome message..

*** The = flag. (Events only)

This flag is used to prevent anything from happening.... you can use it to not bother higher level people with events meant for lower level people.

Example:
1:ON JOIN:#mine:/ctcp $nick VERSION
3:ON JOIN:#mine:=
Level 1 and 2 users will be versioned while level 3 and higher users will not see anything at all,... nor you. (In version 3.2 you had to set up an harmless event to do this.)

Example:
1:ON JOIN:#test1:/notice $nick Welcome to #test1
1:ON JOIN:#test2:/notice $nick Welcome to #test2
3:ON JOIN:=
Level 3 and higher users won't be noticed Welcome.... lower level users only on #test1 and #test2.

*** The + flag.

This flag makes a certain command available ONLY to users with the EXACT level of the command... Higher (and of course lower) level users can't use/access it !

Example:
1:ON JOIN:#mine:/ctcp $nick VERSION
+3:ON JOIN:#mine:/notice $nick Welcome here.
All users EXCEPT level 3 users will be versioned on channel 'mine' ... Level 3 users will be welcomed...

Example:
+5:ON JOIN:#mirc:/msg $nick Welcome level 5 user!

*** The ; and REM flag.

These flags can be used to switch off commands or events temporarily by 'commenting them out'.
Example:
;1:ON JOIN:#mine:/notice $nick Welcome here.
REM 1:ON JOIN:#mine:/notice $nick Welcome here.

*** The * and @ flags.
Thise flags makes mIRC to execute an event or command ONLY if you're operator on the channel the event or commands if used on.
*1:ON JOIN:#mine:/notice $nick Welcome here.

*** The me flag.
This flag is designed to make sure you can make events only work if somebody with exactly the same address as you use does something. This other person normally would be your 2nd instance of mIRC running from the same PC. Keep in mind that with proper leveling of your users in the Remote/users section you never (?) need this flag.

In mIRC version 3.7 some additional flags for the EVENTS were introduced. With these flags you can make mIRC to take into account the level of the person that started an EVENT.
These flags can only be used with the ON OP, DEOP and KICK events since these are the only events that deal with somebody doing something to somebody else.
The three flags you can add are >, < and =. But you can make mathematical combinations of them leading to a set of 6 flags: <, >, <=, >=, <> and =.

These flags will make the event only be triggered if FIRST the level of the event fits the Opped, Deopped or Kicked guy (m/f) and then SECOND the level of the activator meets the
expression {level-activator} [flag (mathematical expression)] {level-of-event}

You look like you need some examples ....

Assume you being the GUARD with a Friend at level 2 and an Activator who can have several different levels.... Then imagine these simple EVENTS :

<2:ON DEOP:#test123:/msg $chan the < triggered
>=2:ON DEOP:#test123:/msg $chan the >= triggered

With the activator at level 1.
*** Activator sets mode: -o Friend
<GUARD> the < triggered
Your Friend has level 2, the Activator has level 1, 1<2 is valid (one is smaller than 2), the first level 2 ON DEOP event is triggered...

With the activator at level 2.
*** Activator sets mode: -o Friend
<GUARD> the >= triggered
Your Friend has level 2, the Activator has level 2, 2<2 is invalid, 2>=2 is valid (2 is larger than or equal to 2), the second level 2 ON DEOP event is triggered...

With the activator at level 3.
*** Activator sets mode: -o Friend
<GUARD> the >= triggered
Your Friend has level 2, the Activator has level 3, 3<2 is invalid, 3>=2 is valid (3 is larger than or equal to 2), the second level 2 ON DEOP event is triggered...

As you can see its pretty straight forward once you got the idea .... read this over till the coin drops... More examples :

<2:ON DEOP:#test123:/msg $chan the < triggered
>2:ON DEOP:#test123:/msg $chan the > triggered

With the activator at level 1.
*** Activator sets mode: -o Friend
<GUARD> the < triggered

With the activator at level 2.
*** Activator sets mode: -o Friend

With the activator at level 3.
*** Activator sets mode: -o Friend
<GUARD> the > triggered

=2:ON DEOP:#test123:/msg $chan the = triggered

With the activator at level 1.
*** Activator sets mode: -o Friend

With the activator at level 2.
*** Activator sets mode: -o Friend
<GUARD> the = triggered

With the activator at level 3.
*** Activator sets mode: -o Friend

Variables

See Tools/Remote, select the box called "Variables" ...

mIRC now allows you to define all kinds of variables. Variables always start with a % and can have names of any length. The variables are stored between sessions in a variable file in the mIRC directory. Variables can contain numbers, words or even lines of text. With variables containing numbers you can apply mathematical manipulations to increase, decrease, add and subtract variables with given values to or from each other. Available commands are : (q=quiet; no status report of the operation is given)

/set [-q] <%var> [value] To create a variable
/unset [-q] <%var> [%var2] ... [%varN] To delete a variable
/unsetall To delete all variables
/inc [-q] <%var> [value] To increase a variable by a value (number or variable)
/dec [-q] <%var> [value] To decrease a variable by a value (number or variable)

With the aid of these commands you can make all kinds of handy aliases and remote lines!

Let me give a bunch of examples :

Remote commands (see later) :
2:xdcc send #1:/dcc send $nick c:\temp\serve\mirc40.zip | /inc %mirc 1
2:xdcc send #2:/dcc send $nick c:\temp\serve\mircfq24.zip | /inc %faq 1
1:stats:/notice $nick Sending stats: mIRC= %mirc and FAQ= %faq

Remote events (see later) :
2:ON TEXT:xdcc send #1*:?:/dcc send $nick c:\temp\serve\mirc392.zip | /inc %mirc 1
2:ON TEXT:xdcc send #2*:?:/dcc send $nick c:\temp\serve\mircfq23.zip | /inc %faq 1

Alias :
/stats /echo 6 mIRC: %mirc and FAQ: %faq

With these lines I made a small download counter.... not perfect but working !

You can even add some alias like the next one to keep partial statistics :
/reset /set %date $day $date | /inc %mirctot %mirc | /inc %faqtot %faq | /set %mirc 0 | /set %faq 0
/stats /echo 6 Stats mIRC: %mirc ( %mirctot ) and FAQ: %faq ( %faqtot ) (Set on %date )

When you increase or decrease a non-existant variable it will be created automatically and set to the value you expect it to be. ie :
/inc %test1 6 will set %test1 to 6 if it didn't exist before
/dec %test2 7 will set %test2 to -7 if it didn't exist before

Note : You have to make sure you always include the % ! This is made to prevent a lot of small possible problems in mIRC's command parsing. This does not limit the ways the variables can be used in at all since you can always use constructions like :
1:upme:/inc % $+ $site 1
2:xdcc send #1:/dcc send $nick c:\temp\serve\mirc40.zip | /inc % $+ $nick 1
2:xdcc send #2:/dcc send $nick c:\temp\serve\mircfq24.zip | /inc % $+ $nick 1
2:xdcc stats:/notice $nick You downloaded %nick files already since %date

Remote Raw processing.

In the Tools/Remote/Raw section mIRC offers you the possibility to process all server to client (mIRC) processes directly and in any way you want/like. It works exactly like the Rempte/Events section except mIRC listens to the NUMERIC events. These server numerics are described in the IRC RFC1459 (http://ds.internic.net/rfc/rfc1459.txt). The remore/Raw has it's own separate editbox because if mIRC had to scan your whole remote events definitions list for each numeric event, things would slow down to a crawl. Still you better use the Raw section -only- if you exactly know what you do and only if absolutely needed. Wrong use of the Raw section can mess-up mIRC totally. It can over-rule all routines hardcoded into mIRC. Example:
322:*mirc*:/echo 2 $parms

 This would print all lines which have the word "mirc" in them when you do a channels /list (this is a pretty intensive test).

 To echo a concise 2 line summary of the /whois return in your active window, place the following lines in your Raw section (listening on):
311:*:echo 5 $active *** $parm2*
319:*:echo 5 $active *** $parm2*

This will display the user and channels lines. The numerics for the other /whois replies are: 312, server; 313, ircop; 301, away; 317, idle; and 318, end. For a full /whois echo, simply duplicate the above lines using these numbers.

To find out the numerics the servers use you could use the new $numeric identifier that refers to the number of the (raw) event that was triggered. In the IRC RFC1459, Section 6; Numeric replies, you can look up all numerics, given with their number, name and reply string.

Advanced use of commands; Scripting.

In mIRC you can use commands and create aliases, popups and remotes with conditional statements, loops and other tricky things. To explain it all to you would would take another complete FAQ I fear, but I'll try to get you on the road in a short section with some examples. I think its best to start right off the bat .....

 First mIRC now allows multiline alias, popup, and remote definitions. This allows you to write statements in a nice and structured way like:

 {prefix definition} {
/command1 ...
/command2 ...
/command3 ...
}

 Example:
/away /ame is AWAY ( $+ $?="Reason" $+ ) | /away Set away at $time { $+ $! $+ }
/back /ame is back,.. what did I miss ? | /away

 These aliases could also be defined as

 /away {
/ame is AWAY ( $+ $?="Reason" $+ )
/away Set away at $time { $+ $! $+ }
}

 /back {
/ame is back,.. what did I miss ?
/away
}

 I agree that doesnt really help -here-, but while you're writing and testing the new possibilities in mIRC's conditional commands you might like this structure? Btw, the { } brackets are needed around all commands that use the new possibilitie of conditional looping etc. Now we're at it, you could leave out all / command prefixes if you wanted to... They are no longer needed.

A /goto command is added which can be used in { } definitions.
Example:
/greet {
/set %x 0
:retry
/inc %x
/goto %x
:2
/echo line2
/halt
:1
/echo line1
/goto retry
}

 This alias will echo the lines "line1" and "line2" to your screen.
Test it by giving this totally equivalent command in some editbox:
/set %x 0 | :retry | inc %x | goto %x | :2 | echo line2 | halt | :1 | echo line1 | goto retry

 It will show you exactly what happens. ;-) You can also use a variable as a goto name, eg. :%jumppoint

 If you "/set %jumppoint 5" then you can do "/goto 5" and mIRC will evaluate %jumppoint to 5 and jump to it. In the above example the jumppoints were fixed to '1' and '2'. Try these 3 commands and see what happens now.
/set %jump1 1
/set %jump2 2
/set %x 0 | :retry | inc %x | goto %x | :%jump2 | echo line2 | halt | :%jump1 | echo line1 | goto retry

 You can use the /return command to finish processing a command and to allow any default processing to continue. eg.
1:ON JOIN:#mIRC {
/echo 3 #mirc [Joins $nick]
/return
/echo 3 #mirc I'm not printed!
}

 This will result is messages like:
[Joins henk]
*** henk ([email protected]) has joined #mIRC

 /if /elseif /else

 Now I think you're ready for the real stuff ?? In mIRC a simple /if statement is available.
/if v1 operator v2 { ... } | /elseif v1 operator v2 { ... } | /else { ... }

 Example:
Make this alias and start it like "/test 4";
/test { set %i 0 | :start | inc %i | if %i > $1 halt | echo $active %i | goto start }

If/elseif/else can all be nested inside each other. You should use () and {} brackets to make sure that you're terms are evaluated correctly (in the correct order), though you don't *have* to use them. Using brackets also speeds up processing quite a bit since mIRC then knows exactly what it has to evaluate.

 Available comparisons and operators:
== equal to
!= not equal to
< less than
> larger than
>= larger than or equal to
<= smaller than or equal to
// is a multiple of
\\ is not a multiple of

 isin string v1 is in string v2
iswm wildcard string v1 matches string v2
ison nickname v1 is on channel v2
isop nickname v1 is an op on channel v2
isnum number v1 is a number in the range v2 which is in the form n1-n2 (v2 optional)
ischan if v1 is a channel which you are on.
isauto if v1 is a user in your auto-op list for channel v2 (v2 optional)
isignore if v1 is a user in your ignore list with the ignore switch v2 (v2 optional)
isprotect if v1 is a user in your protect list for channel v2 (v2 optional)
isnotify if v1 is a user in your notify list.

 To negate the above you can prefix them with an ! exclamation mark.

 Example:
/massinvite { echo 4 * Mass-inviting # | set %i $nick(0,#) | :next | if $nick(%i,#) != $me invite $nick(%i,#) $1 | dec %i | if %i > 1 goto next | echo 4 * Mass-invite # done }

 Use this example alias like "/massinvite #yourchannel". (btw massinvites are very impolite!)

 Example:
/randnopkick { :begin | set %kicknick $nick($r(1,$nick(0,#)),#) | if %kicknick isop # goto begin | /echo 6 %kicknick }

 If you're an op on some channel you might like this random-non-op-kick. It kicks a random person from your channel, but never an op. Mind you.... if only ops are available you've a problem ;-)

Example:
/line { %line = "" | if $asc($1) < $asc($2) { set %i $asc($1) | :add | %line = %line $chr(%i) | inc %i | if %i <= $asc($2) { goto add } | if (%line == "") { halt } | else { echo # %line | halt } } else echo # sorry not valid }

 Start this alias example by typing "/line d k" to see what it does. It will print a line like 'd e f g h i j k'. Nothing much and barely useful but it shows the strength of the if/elseif/else pretty well.

 Example:
/printnum1 { if $len($1) = 1 { if $1 !isin 1234567890 { echo 6 $1 is not a number | goto end } } | elseif $len($1) = 2 { if $mid(1,1,$1) !isin 1234567890 { echo 6 $mid(1,1,$1) is not a number | goto end } | elseif $mid(2,1,$1) !isin 1234567890 { echo 6 $mid(2,1,$1) is not a number | goto end } } | elseif $len($1) > 2 { echo 6 $1 has too many chars | goto end } | { set %x 1 | :begin | echo 6 %x | if %x >= $1 { goto end } | else { inc %x | goto begin } | :end } }

 /printnum2 { if $1 !isnum { echo 6 $1 is not a number | goto end } | elseif $1 !isnum 0-99 { echo 6 $1 is a too large number | goto end } | { set %x 1 | :begin | echo 6 %x | if %x >= $1 { goto end } | else { inc %x | goto begin } | :end } }

 These equivalent aliases will both print a list of numbers upto the value you give. Try it with "/printnum1 14" or something similar .... The second alias shows how smart use of identifiers can reduce the length of the alias a lot.

 Empty or invalid identifiers

 Variables or identifiers that don't evaluate to a value now return the value $null so they can be used in the if statement for checking etc.

Example:
/listops { echo 4 * Listing Ops on # | set %i 1 | :next | set %nick $nick(%i,#) | if %nick == $null { goto done } | if %nick isop # { echo 3 %nick is an Op on # } | inc %i | goto next | :done | echo 4 * End of Ops list }

 This alias will list all ops on the channel you're on.
Or in a remote event:
1:ON CTCPREPLY:PING* {
if ($parm2 == $null) echo [ $+ $nick PING reply]
else {
%pt = $ctime - $parm2
if (%pt < 0) set %pt 0
echo [ $+ $nick PING reply] %pt seconds
}
halt
}

 More popup examples:

 GiveOps { %i = 0 | %nicks = "" | :nextnick | inc %i | if ($snick(%i,#) == $null) { if ($len(%nicks) > 0) mode # +oooo %nicks | halt } | %nicks = %nicks $snick(%i,#) | if (4 // %i) { mode # +oooo %nicks | %nicks = "" } | goto nextnick }

 This popup menu item will op all selected people on a channel where you're operator.

 Selkick:/kick # $token($r(1,$snick(0,#)),44,$snicks)

 This popup will kick one random person out of the people you selected on a channel.

 RandNopkick:/kick # $nopnick($r(1,$nopnick(0,#)),#)

 This popup will kick a random non-operator from the channel you're on.

 RandNopkick { :begin | /set %kicknick $nick($r(1,$nick(0,#)),#) | if %kicknick isop # goto begin | /kick # %kicknick }

 This popup will also kick a random non-operator from the channel you're on.

 Randkick:/kick # $nick($r(1,$nick(0,#)),#)

 Arent kicks fun ???? Another one ... randomly kicking just anybody .... might be -you- !

 RandOpkick:/kick # $opnick($r(1,$opnick(0,#)),#)

 Randomly kicking an op .... they at least can defend themselves !

 Endless loops.

 With all these conditional statements I foresee you ending up in some endless loop. A simple example is creating something like:

 /loop { :start | echo 6 # test loop | goto start }

 I case one of your aliases or remotes got into such a loop use the CTRL+Break key combination to stop the process. It will take you home safely.

 
Go Back