mIRC ScriptBox
Frequently Asked Questions (FAQ)

Collected by the #HelpDesk (DALnet) Team


This document contains most common questions asked in our #HelpDesk Channel on DALnet.

Table of Content

How Can I Do Colours?  Back to Top

First, in any channel Editbox, press the [ctrl] button and [k]. A window may or may not popup. This window is simply a colour guide. You can turn it on by going to General Options (Press Alt and O), Extras Tab. Put a tick on the 'Pop up Colour Index' box. After pressing [ctrl] and [k] (sometimes abbreviated as ^k) type a number from 0 to 15. For demonstration purposes press 04 (red). Your editbox should look like 04. Now type a word, like hello. The editbox should now look like: 04hello. Now press enter. hello will appear in the channel.

If you want to add a background colour, the format is similar. Press [ctrl] and [k]. Select a number from 0 to 15 - lets try 03 this time. Next (this is the new part) press , (comma) followed by another number from 0 to 15 - I will use 06 . Now type in a word. For this example I will use the word 'pizza'. Your editbox should look like this: 03,06pizza . Press enter.

NOTE: Its very important that if the number of the colour you want is UNDER 10, that you put a zero in front of it. Eg:
1 to 01
2 to 02
3 to 03
This is because sometimes the text you want to colour STARTS with a number, and this number joined onto the colour code MAY alter the colour if you did not put a zero in front of the colour numbers.

When putting the colour code in a script, alot of people find it easier to use $chr(3) instread of ^k - as it is alot more easier to read than a block. You must remember when putting the $chr(3) in a script, to put a $+ after it and before the number of the colour. Example:

on *:CONNECT:{
 echo -a $+($chr(3),03) *** Connected to $+($server,:)
 echo -a To join a channel, type $+($chr(3),02) /join #channel. $chr(15)
To change your nickname, type /nick NewNickname.

As you can see, I put $+($chr(3),colour number). The $+( , ) links the colour code and the colour number together - if it was not there, there would be a space between the colour  code the the colour number. This means that mIRC would think that you did not specify a colour.

How can I rejoin the channel I was kicked from and kick/ban someone who just kicked me?  Back to Top

We at #helpdesk do not believe in the use of 'revenge scripts', thus we will not help with any kick back. The below script will try unban you when you are banned, and rejoin the channel when kicked - no revenge:

on *:BAN:#:{
  IF ($banmask iswm $address($me,5)) { 
    IF ($me isop $chan) { 
	  mode $chan -b $banmask 
	chanserv unban $chan me
on *:NOTICE:All bans against you on *:*:{
  join $6
  .timer 1 1 chanserv op $6 $me
on *:KICK:#:{
  IF (($knick == $me) && ($nick != $me)) { join $chan }

The on BAN line checks to see if the ban placed effects you. If it does, then it will try to remove the ban. If you are not an op, it will try and tell ChanServ to unban you. If ChanServ does unban you, you will automatically join the channel. It will also try and rejoin the channel as soon as you are kicked.

How can I kick people for swearing?  Back to Top

This task does not require much knowledge of mIRC Scripting. All you need is one on TEXT line and an if-then-else statement. The following line goes into your remotes:

on @*:TEXT:*:#:{
  IF ((swearword1 isin $1-) || (swearword2 isin $1-) || (swearword3 isin $1-)) {
    kick $chan $nick No Swearing: $ifmatch detected
    ban $chan $nick 3 

Where swearword1,2 and 3 are, put the swearwords you want to kick on. You can have heaps of words - just put an additional
|| (swearword3 isin $1-) in the if-then-else statement. When a swear word is detected, mIRC will kick and ban the user, stating which swear word made it kick the person (You can stop this by removing : $ifmatch detected)

NOTE: $v1 replaces $ifmatch since mIRC version 6.16

How can I make an Autogreet?  Back to Top

Autogreets use the on JOIN event. The on JOIN event reacts when anyone joins a channel you are on. So in your remotes (Press ALT and R to open the remote editor) put:
on !*:JOIN:#channel:{ .notice $nick Your message here. }

The ! in front of the * means the on JOIN will only work when people OTHER than you join the channel.

The . (period) in front of notice will not display the notice on your window, but it will still come up on the other persons window.
If you want to have an on/off switch for your autogreet look at the following example:

menu menubar { 
  AutoGreet ( $+ $group(#autog) $+ ) 
  .On: { 
    .enable #autog 
    SET %autog.chan $$?="What channel(s) should I run in?" 
    SET %autog.msg $$?"="Enter autogreet message:" 
  .Off: .disable #autog 

#autog on 
on !*:JOIN:%autog.chan: { msg $nick %autog.msg }
#autog end
Similar to the variable example, this one instead of setting a variable on or off turns a group on (.enable #autog) or off (.disable #autog).

How can I stop the timer from echoing in my status?  Back to Top

The secret to stop commands from doing their default echo is to put a "." (full stop) in between the / and the command itself. Here are some examples:
/.timer 1 1 /echo -a YAY NO ECHO!
//.notice $me Hey look! I don't see the notice being sent but it still comes through!

How can I Notice all the Ops & Voices?  Back to Top

This is an easy task, to notice all the ops & voices in a channel, type /notice @+#channel message
To notice the ops and voices, type /notice @+#channel message
To notice just the ops, type /notice @#channel message

Of course you could alias these, and put in some fancy ascii and colours. Op/Voice Noticer Example:

alias ov {
  notice @+ $+ $active [ $+ $chan $+ (OP&VOICE)] $1-

Op Noticer Example:

alias on {
  notice @ $+ $active [ $+ $chan $+ (OP: $+ $opnick(#,0) $+ )] $1-
Take a look at a more advanced example.

How can I colour a nickname on the nicklist?  Back to Top

mIRC has a command, /cline that can, among things, colour nicknames on the nicklist. The format for /cline is:

/cline colour-number window nickname/line number

Lets say we want to colour the nickname Connector on #helpdesk brown (which is number 15 in mIRC). You would type the following:

/cline 5 #helpdesk Connector

But what if I want to colour the n'th nickname on #channel?

Simple: Just type

/cline colour-number #channel n'th-nickname

e.g. /cline 2 #helpdesk 1

This would colour the first nickname on #helpdesk blue (2).

A lot of people have asked how can I colour all nicknames on a channel, all at once. The answer: Use an alias like the one below.

alias colour.chan {
  SET %cc.total.ops $opnick($1,0)
  ; See how many ops are in the channel
  SET %cc.total.voice $vnick($1,0)
  ; See how many voices are in the channel
  SET %cc.ops.current 0
  SET %cc.voice.current 0
  INC %cc.ops.current 1
  ; Select the n'th op nick
  cline 2 $1 $opnick($1,%cc.ops.current)
  IF (%cc.ops.current < %cc.total.ops) { GOTO ops }
  ; If i've done all the ops, then the above if statement will let me move on to the voices
  INC %cc.voice.current 1
  ; Select the n'th voice nick
  IF ($vnick($1,%cc.voice.current) !isop $1) { cline 11$1 $vnick($1,%cc.voice.current) }
  ; The above if statement checks to make sure that the nick is not a voice and an op
  IF (%cc.voice.current < %cc.total.voice) { GOTO voice }
  ; If i've done all the voices, then the above if statement will let me continue alias.
  UNSET %cc.*

This alias should be used in conjunction with an on JOIN event like:

on me:*:JOIN:#:{ .timer 1 2 /colour.chan $chan }

The 2 (in cline 2 $1 $opnick($1,%cc.ops.current)) is the colour ops will be (Dark Blue)
The 11 (in cline 11$1 $vnick($1,%cc.voice.current)) is the colour voices will be (Light Cyan)
For the colour of normal nicks, just change the nickname colour in mIRC's Colour Editor (Alt + K)

NOTE: When a person ops/deops/voices/devoices their colour won't change using the above. Try and script something that will (Hint: Use on VOICE,DEVOICE,OP, and on DEOP).

How can I kick someone for Repeating?  Back to Top

Put this line in your remotes. This line will only work if you are an op on the channel where the person repeats. For a person to be kicked & banned, they must say the same thing twice, side by side, in ten seconds (You can change this by adjusting the highlighted -u10).
on @*:TEXT:*:#: {
  IF ( %rep. [ $+ [ $chan [ $+ [ $nick ] ] ] ] == $1- ) {
    ban $chan $nick 3
    kick $chan $nick repeating
  SET -u10 %rep.  [ $+ [ $chan [ $+ [ $nick ] ] ] ] $1-

It will kick on something like this:
repeater: im a repeater lalallalala
repeater: im a repeater lalallalala

But it will not kick on something like this:
repeater: im a repeater lalallalala
repeater: hahahha
repeater: im a repeater lalallalala

In other words, the person has to say something two times in a row (sequential).

How can I make an Auto Voicer (AV)?  Back to Top

Auto Voicer's usually use USER LEVELS. Here is an simple script that will do the job.

In remotes put:

on @VOICE:JOIN:#channel1,#channel2,#channel3,etc...: {
  mode $chan +v $nick

To add a person to the Auto Voice list, type /guser -a VOICE nickname 3
To remove a person from the Auto Voice list, type /ruser VOICE nickname 3

If you want, here are the nicklist popups for adding/removing people. To get to the nicklist popup editor, press ALT and P, select the View menu, and click on Nicklist. Insert the following:

  .Add AV: guser -a VOICE $$1 3
  .Del AV: ruser VOICE $$1 3

Where #channel1,#channel2,#channel3,etc... is, put in the #channels that you want the auto voice to work on. Where nickname is, replace it with the nickname of the person you want to add or remove from the auto voice list.

How can I make an Auto Pinger and Replyer?  Back to Top

A good way to auto ping someone is when they say the word "!ping". To autoping someone for saying !ping, you need the following remote using the CTCP Event:
on *:TEXT:*!ping*:*:{ .ctcp $nick ping }

To automatically respond when we get a reply, we need to use the CTCPREPLAY Event. The following is a basic ping replyer:

.notice $nick Your ping reply is $duration($calc($ctime - $2))

The $duration($calc($ctime - $2)) part of the line figures out the ping reply. When someone is ping, they send a ctcp back to the user who pinged them. The reply contains a number that represents the current time of the user ($2). The number can then be subtracted FROM your current time value ($ctime). This will then find the number of seconds it took since the ping reply was sent to you. The $duration bit simply turns the number into weeks, days, hours, minutes and seconds.
$ctime is a identifier that can be difficult to understand at first - but it has many useful applications.

How can I keep track of my Lagg, in Miliseconds?  Back to Top

You can keep track of your lagg by simply inserting a simple script into your remotes. It sends a ctcpreply (LAGGC - A custom CTCPREPLY if you will) to yourself. This CTCPREPLY contains the $ticks value of when you sent the CTCP. The $ticks identifer returns how many ticks has passed since the computer was started. (Side Note: To get the figure into seconds.miliseconds, use $calc($ticks / 1000), to turn the figure into hours, mins, secs, etc.. use $duration($calc($ticks / 1000)) ).

When the script receives the LAGGC ctcpreply, it then subtracts its value ($2) from your current $ticks. This returns the time it took for the ctcpreply to be sent to the IRC server, then sent back to you. Because we only want the time it takes to send a message to the server (as the time it takes to send back to you will not be the same with other people as they are at different locations with different setups - modems etc...) we need to divide the resultant figure by 2 - thus halving the number.

The script then displays the results onto the titlebar, and sets a timer to do another lagg check in 30 seconds time. If you want, change 30 to how ever many seconds you want the script to wait AFTER receiving a  LAGGC ctcpreply, this will change the period between lagg checks.

In Remotes Put:

on *:CONNECT: { dolaggcheck }
  titlebar Your lagg to $server is $calc((($ticks - $2) / 2) / 1000) secs  at $fulldate 
  .timerA 1 30 dolaggcheck 
alias dolaggcheck [ .ctcpreply $me laggc $ticks }

If you do not want to display the results in the titlebar, simply change titlebar to whatever you want. E.g. to echo to the active window change titlebar to echo -a.

In 'lame' terms, this script sends itself a message, once the message has returned the script calculates how long it took for the message to go to the server you are on. The script then displays that time to you - by default in the titlebar.

How can I put a Picture on the Background?  Back to Top

You can by one of two ways. (You must be running mIRC 5.4x or higher)

1) Right click on any channel on the channel toolbar. A popup will open, goto the Background section. Click on "Select...". From there you can select a picture, which has to be a .bmp, .jpg or .png file.

2) You can use the /background command. To load a picture to the current window, type /background -a filename.bmp

How do I make my bot respond to something someone says?  Back to Top

To make your script respond to when someone (other than you) says something, you need to use the on TEXT event in your remotes (Press ALT and R to access the remote editor). The format for on TEXT is as follows:
on LEVEL:TEXT:matchtext:location:{ commands }

Ok, I know that may look confusing, but give me a second to run over it.

LEVEL is just the User Level the person saying some text has to be for mIRC to respond. The default level is 1 or *.  The difference you ask? Click here.

String is the text that a person must say before the on TEXT event will react. So if you had *hello* as your string, then if anywhere in a persons sentence, was the word hello, mIRC would respond. The *'s in front and behind it simply mean hello can be anywhere in the sentence. If there were no *'s, then a person would have to say JUST hello for mIRC to respond. *'s are just wildcards.

Type is the type of text mIRC should listen for, should it listen for text sent to a channel, or text sent as a message to you. Where type is, replace it with one of the following symbols:

# is for channel - you can have # for every channel, or you can name the channel, e.g. #helpdesk.

? is for private message.

* is for BOTH channel and private message.

So lets say we want our script to say hello when someone says hello... - in a channel. We would use the following:

on *:TEXT:hello*:#:{ msg $chan Hello, $nick }

If we wanted to reply when they said hello... just in a private message, not in a channel, we would use the following:

on *:TEXT:hello*:?: { msg $nick Hello, $nick }

If we wanted to do it in both, then we can use the following:

on *:TEXT:hello*:*: { msg $nick Hello, $nick }

Another commonly requested piece of code, is a channel rules script. It uses the on TEXT event:

on *:TEXT:!rules*:*:{ msg $nick The rules are: etc... }

Or if you have many rules, and want to display them one line at a time, use the play command. For this you will need to open up notepad (/run notepad.exe) and put each of your rules on a line by itself. Save it to your mIRC folder, call it rules.txt. Then in remotes put:

on *:TEXT:!rules*:*:{
  .play $nick c:\mirc\rules.txt 600

This will display the filename, rules.txt (Please change c:\mirc\ to where your rules.txt is located) to the person who typed !rules at a speed of 600ms (About 1 line every half second).

I have an ON TEXT line, yet when I type !whatever - IT DOESN'T WORK!  Back to Top

If you do not already know, the "on" in the on TEXT event MUST be included in the remote. You cannot simply put 1:TEXT:!whatever*: etc... YOU MUST PUT on 1:TEXT:!whatever*: or on *:TEXT:!whatever*: etc...

on TEXT lines react to people other than yourself. So ask someone else to type the trigger.
on INPUT lines react to what you type, nothing else.

Still no go? Try the Troubleshooting Section

I have a offensive nickname kicker, yet it won't kick! Why?  Back to Top

The on NICK event relates to a nickname, not a channel. So we have to use the $comchan identifier. Also, when you are kicking, you have to kick the new nickname ($newnick) not the old nick ($nick). Example:
on *:NICK:{
  IF (fuck isin $newnick) { 
    kick $comchan($newnick,1) $newnick Your nick sucks. 

This will kick the person out of the first channel that both you and him are on (But first you need ops). To kick the nickname out of all the channels you and him are in you will need to use a loop.

What is the deal with this on *, and not on 1, stuff?  Back to Top

The usual default level, 1, is unreactive when a person with a named user level does something. This is because a named level has no numeric level. The * level fixes this, as it responds to all levels, including numeric and named. So from now on, try to use on *:EVENT: and ctcp *: instead of on 1:EVENT: and ctcp 1:.

What is a Ping and why is it important to me?  Back to Top

The ping you always here people talking about is the time it takes for a message from one computer to be sent to another on the internet. To ping someone, type /ctcp nickname ping .After one or two seconds - or even as long as two minutes, you will get a reply in your status window. It should look something like this:

[FakeNick PING reply]: 2 seconds

Of course the Ping will not always be the same as above. Using the above example, we can tell that it takes 2 seconds for a message to goto FakeNick from me. This is considered good. If the ping reply was something like 20 seconds, you or the nick may want to change to the same server as the other person is on - thus reducing the ping reply. If someone has a large ping reply, such as 20 seconds, are considered "lagged". This basically means that it will take a long time for them to see what you say.

If you are talking to one person in particular, lets say his nick is Bobbie, and you ping him. You get a reply of 27 seconds. What can you do? You can change to his server for starters. Type /whois nickname to find what server he is on. Then type /server the.server.he.is.on. This should, but not always, reduce the lagg.

Dalnet has a service bot, StatServ, that can inform you of which servers are lagged and not. To view a list of servers, when connected to DALnet, type /msg statserv map

What is the raw number for....?  Back to Top

Look for yourself, not only is it quick, but it gives you a better knowledge of raw. This is a quick way to find a raw number:

In your remotes put:

raw *:*:{ echo -s Raw $numeric $+ ) $1- }

Then, type the command that will activate the raw number you want. If you wanted to find the raw number for a whois reply then you would type /whois nick. If you wanted to find the raw number for channel names, then type /names #channel. If no raw number comes up, then there is no raw for it.

If you want, there is a RAW Reference as well a RAW Tutorial. It tells you all about each raw and comes with some examples.

Why won't /me work in remotes?  Back to Top

There is a remote version of the command "/me". Its called /describe nick/chan text. The reason behind this is because the /me command does not let you specify a channel/nickname.

How can I make a nickname all coloured?  Back to Top

It is done by a add-on, called a Nickname Completor. Each nickname completor has a different type of colouring, and usually a different way of activation. mIRC has an inbuilt nickname completor (Non Coloured). In any channel, type the first one or two letters of a nickname, then press the [TAB] key. A nickname will appear (Unless there are no matches). If you keep pressing the [TAB] key, mIRC will display different nicknames that fit in with the one or two letters you typed.
If you want a simple nickname completor, click here.
For a tutorial on how to make a Nick Completer click here.

What if you want to make your own? Here are some suggestions:

  • Download a pre made one and see how it is coded. See if it uses an on INPUT or Alias or Popup.
  • Most of the time, you will need to use a loop inside an alias or on INPUT.
  • Try to keep the colouring simple, don't go overboard with colours, especially backgrounds.

How can I make a colour talker?  Back to Top

A simple way to always talk in colours is by using the on INPUT event. Its format is:
on LEVEL:INPUT:window:{ commands }

I won't go into detail about the window part, just type /help on input in a mIRC window for infomation about it.

So how do you use on INPUT to make a colour talker you ask? Simple:

on *:INPUT:#: {
  IF ($left($1,1) != /) { 
     msg $active $+($chr(3),06,$1-)

Now to explain.
The IF ($left($1,1) != /) part is used to make sure you are not trying to do a command - if I didn't have this part then if you typed any command in a channel window, that channel would see it!
msg $active sends the text to the current channel,
$chr(3) stands for the colour control code. 06 is the colour I want to use (purple).
$1- is the text I typed into the editbox.
All these are combined using $+( , , ).
The HALT is very important, without it you would say everything twice, one in colour, and one in normal text!

How can I make a backwards talker?  Back to Top

To make a Backwards Talker put this in your remotes (ALT-R):

alias bt {
  ; First we need the number of characters supplied
  VAR %bt.n = $len($1-)
  ; We replace every space by a HARD-Space, since mIRC strips any spaces but one in remotes
  VAR %bt.ft = $replace($1-,$chr(32),$chr(160))
  ; Now we loop through the text and reverse the letters,
  ; The first will be last and so on
  WHILE (%bt.n > 0) { 
    VAR %bt.bt = %bt.bt $+ $mid(%bt.ft,%bt.n,1)
    DEC %bt.n 
  ; Finally we return the new text
  RETURN %bt.bt 
To use it type: //say $bt(This is a test)
This would result in: tsetasisihT

How can I make a fancy talker?  Back to Top

To make a Fancy Talker put this in your remotes (ALT-R):
alias ft { 
  RETURN $replace($1-,a,,b,,c,,d,D,e,,f,F,g,G,h,H,i,,j,J,k,K,l,,m,M,o,,p,,q,Q,r,,s,,t,T,u,,v,V,w,W,x,,y,,z,Z) 
To use it type: //say $ft(This is a test)
This would result in: TH TT

How can I make a Upper/Lower talker?  Back to Top

To make an Upper/Lower Talker put this in your remotes (ALT-R):
alias ult { 
  ; We initialize the needed variables
  VAR %i = 0, %b = $null, %a = 0
  ; We replace every space by a HARD-Space, since mIRC strips any spaces but one in remotes
  VAR %txt = $replace($1,$chr(32),$chr(160))
  ; We start the loop
  ; we take each 2nd letter (done by 2 // %a)
  ; %a will hold the current position of the processed letter
  ; %i will incement the position
  ; Thus the loop continues until all letters are counted
  WHILE (%i < $len(%txt)) {
    ; We start with the first letter
    INC %a 
    INC %i 
    %b = %b $+ $iif(2 // %a,$Upper($mid(%txt,%i,1)),$lower($mid(%txt,%i,1))) 
  ; We finally pass back the resulting text
  RETURN %b 
To use it type: //say $ult(This is a test)
This would result in: tHiSIsatEsT

How can I automatically identify to nickserv when I connect to IRC?  Back to Top

Auto Identification is not very secure - as it is possible for someone to assume the nickname of nickserv and gain your password when you logon. We recommend instead of an autoid, that you use a Function Key (F1-12) or another alias. First, Press [Alt] and [A]. The Alias Editor will pop up. In a blank line, put:
F5 /nickserv identify YOUR_PASSWORD

Where 5 is, put the number of the Function Key (F2-12) you want to press to identify to nickserv. The F1 is reserved for the mIRC Help File. The function keys are usually located to the right from the [escape] key. They number usually from 1 to 12 - they sometimes go to 16 or 24. You also need to replace YOUR_PASSWORD with your nickserv password. Remember that passwords are CaSe SenSiTive. That means that STAR is not the same as star or StaR. Next time you want to identify to nickserv, simply press the F-Key that you choose.

You don't have to use a F-Key. You could just type out an alias like /nickid and it will identify to nickserv. To do this, simply replace the "F5" with a name of your choice like "nickid". Example:

nickid /nickserv identify YOUR_PASSWORD

How can see all ASCII Codes in a mIRC window?  Back to Top

To see all ASCII codes, put this in your aliases (ALT-A):
ascii { 
  ; We make a custom window named ASCII
  window -l -t15,30 @ASCII -1 -1 400 300
  ; We make a head line
  aline @ascii Character $+ $chr(9) $+ ASCII value $+ $chr(9) $+ Alt+<keypad>
  ; We start with the space (charcter number 32)
  VAR %a = 32
  ; We loop until we reach character 255 
  WHILE (%a <= 255) { 
     ; We add the resulting line to the window 
     aline @ascii $chr(%a) $+ $chr(9) $+ %a $+ $chr(9) $+ $base(%a,10,10,4)
     INC %a 
To use it simply type: /ascii

How can I put a Picture on a Custom Window?  Back to Top

The first thing you need to do to create a picture in a custom window, is open the window. Because we want to load a picture, we will need to use the -p (picture prefix). Example:
/window -p @picture
. Next, you need to use /drawpic to load a bitmap file (It has to be a .bmp, .jpg or .png file).

Now type:

//drawpic -c @picture $pic($mircdirwaves.bmp).width $pic($mircdirwaves.bmp).height $mircdirwaves.bmp

The $pic(filename).height and $pic(filename).width automatically figure out the dimensions, so you don't have to figure them out yourself.

This will load the waves.bmp (Assuming you have it, if you don't then substitute it with a valid bmp) into @picture. The -c switch caches the picture. This means that if you call up the picture again, it will not take as long to load.

The picture can also be stretched and you can display only certain sections of it. The help file, under /help picture windows, discusses this in detail.

If you want to make this window open up everytime mIRC starts, then use the on START event with the drawpic command.

on *:START: {
  window -p @picture
  drawpic -c @picture $pic($mircdirwaves.bmp).width $pic($mircdirwaves.bmp).height $mircdirwaves.bmp

How can I count the number of Kicks and Bans I have done?  Back to Top

First you need to edit your kick command. In aliases put:
kick {
  INC  %kicks 1
  raw -q kick $1 $2 : $+ $3- [Kicks: %kicks ][Bans: %bans ]

Then you need to count all the bans you place. In remotes put:

on *:BAN:#:{
  IF ($nick == $me) {
    INC %bans 1 

This should count all your kicks and bans and display the count in your kick message. If you do not want to display the number of kicks & bans you have done, then remove [Kicks: %kicks ][Bans: %bans ] from the kick line.

How can I Display a Text file onto a @Window?  Back to Top

mIRC has a command, loadbuf, which will do what we need. It will load the specified lines of a text file onto a @window. Its format is:
/loadbuf [lines] [-psglecN] <window> <filename>

Now before we can load the text onto a @window, we need to open the window. For this example, I will call the window @text (/window @text). The switch I will use is -p so that if any line is too long for the window, it will wrap to the next line. A full list of the switches can be found by typing /help /loadbuf.

Now once the window is open, we can use /loadbuf. Example:

/loadbuf 1-89 -p @Text readme.txt

Readme.txt is the readme.txt located in your mIRC folder (Its just the mIRC Readme file). If you do now know how many lines there are in a file, use the $lines identifier. Example:

//echo -a $lines(readme.txt)

If you want to load the whole text file, /loadbuf @window filename will work just fine.

For help on custom windows read our Custom Window Tutorial.

How can I use "GOTO's"?  Back to Top

The /goto command simply makes mIRC jump processing part of a script and move to another part and start processing that section. To make a point where you want to let a goto command jump to, you must give it a label. The label must start with : (colon)or mIRC won't be able to find it. Lets walk through the following example, which will colour the nicknames of a channel in random colours. This is an alias, so put it in your aliases :)
nickcolour {
  ; finds how many nicks are on the channel.
  SET %totalnicks $nick(#,0)
  SET %thisnick 0
  ; sets which nickname to colour next.
  INC %thisnick 1
  ; colours nickname in a random colour.
  cline $rand(1,15) # %nick(#,%thisnick)
  ; decides whether or not the alias has finished its job.
  IF (%thisnick < %totalnicks) { GOTO start }
The IF (%thisnick < %totalnicks) {GOTO start } is saying if I haven't coloured all the nicknames, I must go back and keep colouring. The start of the colouring is indicated by ":start".
NOTE: You cannot have two labels with the same name. You can have anything for a label, mIRC doesn't care. It could be ":thisisaverylonglablebutmircdoesnotcare"

How can I use User Levels?  Back to Top

User Levels were made so that you can make an event that will only react to an authorized user. The first thing you need to know about user levels is how to add and remove someone from the list.

To add a user to a User Level type:

/guser -a level nick address type
(I prefer to use address type 3)
/guser -a 10 bobbie 3

To remove a user from a User Level type:

/ruser level nick/address


/ruser 10 bobbie

To make an event (like on JOIN) react only to a specific level or higher, replace the 1 in on 1: to the level you want. Example:

on 10:JOIN:#:{ msg $chan Hiya $nick }

This event will only say "Hiya nick" when a Level Ten or higher user joins the channel.
You can make it so it will react ONLY to a specific level by putting a "+" in front of the level (There is a detailed list of different prefixes available in the mIRC Help File under "levels"). Example:

on +10:JOIN:#:{ msg $chan Hiya $nick }

You don't have to user numbers for a level, you can also use letters. Example:

/guser friend bobbie 3
on friend:JOIN:#:{ msg $chan Hiya buddie }

There are also conditional prefixes such as <=,=, and more.

Click here for an Auto Voice script using user levels.

How can I make my own custom op/join/etc... echos?  Back to Top

mIRC 5.4 was released with a great new command, /haltdef. This command in conjunction with an event (like on TEXT) can halt the default output/message. You can then put in your own custom output. The following events support haltdef:


It works by you putting a "^" before the level in the event. This tells mIRC that you might want to use the haltdef command. Example:

on ^*:OP:#: { commands }

Where commands is, you put the commands you want. For this example, we will just do a haltdef with a new output. When the /haltdef command is used, it DOES NOT HALT THE SCRIPT, just the DEFAULT OUTPUT. Here is an example of a changed on OP output:

on ^*:OP:#:{
  echo 2 $chan (OP) $+($chr(2),$opnick,$chr(2)) was just opped by $+($chr(2),$nick,$chr(2))

That line will stop the default
*** nickA sets mode: +o nickB
and replace it with:
(OP) nickA was just opped by nickB
(In the channel the person was opped in of course).

How can I read and echo the data being sent to a Socket Connection?  Back to Top

First, you need to be fairly advanced in the areas of remotes, aliases, identifiers and variables. Next, you need to put an on SOCKREAD event into your remotes. To read the data coming from the socket, and put it into a variable, you need to use the command /sockread %variable. All that is left, is the echo command. Here is a template for you to use:
on *:SOCKREAD:sockname:{
  IF ($sockerr 0) { return }
  sockread %socketdata
  IF ($sockbr == 0) { return }
  IF (%socketdata != $null) { echo -s %socketdata }
  GOTO nextread

Where sockname is, you need to put the name of the socket from which the data you want to echo is being sent.
The sockread %socketdata line, as I talked about before, reads data received and puts it into a variable (%socketdata).
The IF (%socketdata != $null) { echo -s %socketdata } line makes sure that %socketdata is not empty before echoing to the status.
The other if lines make sure that all the data from the socket is read.

You may also want to view the Introduction to Sockets section.

How can I make a Flood Kicker?  Back to Top

Flood kickers can be one of the most complex and brain racking scripts a scripter can make. If you know nothing about evaluation brackets and variables and ini's, I suggest you download a pre made one. The general way a flood kicker works is whenever someone says something, the script adds it to its counter. Each nickname has his/her own counter (Usually in the form of a variable or an ini entry). When the user says a certain amount of lines in so many seconds, the script will usually kick and ban the user. Like I said before - this can get complicated. I have seen many flood kickers with over 30 lines easy.

If you want, there are several scripts for Flood Protection

How can I make a File Server (fserve) for my mIRC?  Back to Top

The command to start a file server is
/fserve <nickname> <maxgets> <homedirectory> <welcomefile>
It is usually used with an on TEXT event. This example of a fserve goes in your remotes:
on *:TEXT:!keyword:*:{
  fserve $nick 1 c:\mirc\fserve c:\mirc\welcome.txt

Where I put !keyword, you can put any word or sequence of words. You don't even have to start it with a '!'. You could make your keyword "thisisaverylongkeywordthatidontthinkanyonewouldevertypeout" - mIRC doesn't really care. The !keyword is just a word that will open up a file server with a person who says that word.

The <maxgets> is 1 in my example. What this means is that a person can only ever download 1 file at a time from you. Of course you can change "1" to whatever you like.

The <homedirectory> is basically the place that the file server will let a user have access to. This is the place where you should put all the files you want to let people be able to download. NEVER make it C:\ - this gives people access to any file on your C:\ drive!

The <welcomefile> is just a text file that you make which contains a welcome message. This message will be displayed when a person first joins a file server. Some people put contact info in the welcome file, others put a list of commands that the fserve accepts. Others just like to put in a fancy ASCII logo.

You can also put a short description about each folder that the file server has access to. To do this, simply put a file: dirinfo.srv ,into that folder. To make the file dirinfo.srv use notepad or write. Put the description of the folder into this file, then save the file into the folder that you want it to display the description. So if you wanted to have a description for the folder c:\fserve\midis you would open up write or notepad, and make up a description such as:

This folder contains my fav. midis.
I hope you enjoy them.
If you want, I can send you a zip of them all, 
just ask me in an IRC channel.
Then save the file as c:\fserve\midi\dirinfo.srv

A list of all the commands that a file server has can be found by typing in a mIRC editbox /help file server

How can I put a Whois onto a window?  Back to Top

First things first, to echo a whois to a @window, or the active window, needs you to have some understanding of raw and custom windows. The whois comes in the form of a who reply - which we need to use the raw prefix to capture.
The following raw codes have been used in the whois reply (although some may not be active on some IRC networks):

301, 307, 308, 309, 310, 311, 312, 313, 317, 318, 319

If you wish to know what each of these numbers represents, take a look at our RAW Events Reference.

The first raw whois reply to arrive to mIRC is the 311. It stands for the nickname, user, host, and real name. So it would seem appropriate that we would open a custom window here.

Here is the worked code to put in remotes:

raw 311:*: {
  window -oda @Whois 20 20 580 140
  ; opens a desktop (-d) window, with dimensions 580 long, 140 high.
  clear @Whois
  ;clears the window if there was any previous whois
  aline -p @Whois $2 is $3 $+ @ $+ $4 $5-
  ;this aline gives Nick is username@isp.domain * Real Name
raw 301:*:{ aline -p @Whois $2 is away: $3- | HALT }
raw 307:*:{ aline -p @Whois $2- | HALT }
raw 308:*:{ aline -p @Whois $2- | HALT }
raw 309:*:{ aline -p @Whois $2- | HALT }
raw 310:*:{ aline -p @Whois $2- | HALT }
raw 312:*:{ aline -p @Whois $2 is using $3 - $4- | HALT }
raw 313:*:{ aline -p @Whois $2 is an IRC Operator | HALT }
raw 317:*:{
  ;raw 317 returns the idle time - $duration($3) 
  ;and when the person logged onto the IRC Server - $asctime($4)
  ;the $4 is a $ctime value, and to undo this, we need to use $asctime.
  aline -p @Whois $2 has been idle for $duration($3) $+ , signed on $asctime($4)
raw 319:*:{ aline -p @Whois $2 is on $3- | HALT }
raw 318:*:{ aline -p @Whois End of /whois | HALT }

The $2 identifier always stands for the whois'd persons nickname. Of course you will probably want to edit this to include colours, and other misc. stuff. For this you really must at least learn the raw replys for the whois.

If you wish to move the whois to the active window, not a @Whois window, change aline -p @Whois to echo -a , and remove:

window -oda @Whois 20 20 580 140
; opens a desktop (-d) window, with dimensions 580 long, 140 high.
clear @Whois

How can I scan for clones?  Back to Top

The simplest way to detect clones (multiple connections from the same address) is to use the $ialchan identifier with an on JOIN event. But first to make the $ialchan (Internal Address List) work, you need to make sure "Internal Address List" in the remote editor/options menu is ticked. You also need a remote which updates your ial list every time you join a channel. This involves sending a /who #channel command as the /who command is used to update the IAL. For this I use the remote:
on me:*:JOIN:#:
  IF ($chan(#).ial == $false) { who $chan }

The IF ($chan(#).ial == $false) simply checks to see if mIRC knows all the addresses of nicknames in the channel you just joined. If it doesn't, then it will try and get all the addresses.

Now for the clone scan part. For this example we will use an on JOIN method - though if you want to, you could try scripting an alias.

on !*:JOIN:#: {
  IF ($ialchan($wildsite,#,0) > 1) {
    ;The above ialchan returns the number of nicknames 
    ;in $chan with the same address ($wildsite) of the person
    ;who just joined.
    ;if it is greater than 1, then clones have been found.
    SET %clone.scan.total $ialchan($wildsite,#,0)
    SET %clone.scan.current 0
    mode $chan +b $wildsite
    ;bans the clones - so they cannot channel flood or 
    ;change nick or let any more clones join the channel.
    IF (%clone.scan.total > 10) {
      echo $chan $chr(3) $+ 04*** Clone Scan: Too many clones to kick, may risk being flooded off.
      echo $chan $chr(3) $+ 04*** Clone Scan: A ban will still be placed.
      ;In an event where many (maybe 10 or over) clones join a channel, 
      ;mIRC may appear to freeze - this is because all of
      ;the clones are joining at the same time. 
      ;If this is the case, then you may be flooded off mIRC. 
      ;The above line fixes this.
    ;find the nickname of each clone, and kick them one by one
    INC %clone.scan.current 1
    SET %clone.scan.list %clone.scan.list $+ $ialchan($wildsite,#,%clone.scan.current).nick $+ ,
    IF ($ialchan($wildsite,#,%clone.scan.current).nick !isin %clone.kick. [ $+ [ $chan ] ]) {
      SET -u10 %clone.kick. [ $+ [ $chan ] ] %clone.kick. [ $+ [ $chan ] ] $+ $ialchan($wildsite,#,%clone.scan.current).nick $+ ,
      kick $chan $ialchan($wildsite,#,%clone.scan.current).nick %clone.scan.total Clone(s) Detected.
    IF (%clone.scan.current < %clone.scan.total) { goto start }
    echo $chan $chr(3) $+ 04*** Clones Detected from $site $+ : %clone.scan.list
    UNSET %clone.scan.list

How can I do some command when a netsplit happens?  Back to Top

Netsplits can usually be detected through the quit message a person "leaves" when a netsplit occurs. Usually the quit shows the two servers that have split which caused the person to appear to quit. Thus it should make sense to you that to listen for a netsplit, on QUIT can be used. Below is a worked example of a simple netsplit detector (Its designed for use within DALnet, but you can adjust the dal.net parts according to your IRC network):
on *:QUIT: {
  IF ((dal.net isin $1) && (dal.net isin $2) && ($3 == $null) && (%split.[ $+ [ $1 [ $+ [ $2 ] ] ] ] == $null)) {
    ;Checks to see if a server name is in the first and 
    ;second words of the quit message.
    ; Also makes sure that there are only two words.
    ; %split.[ $+ [ $1 [ $+ [ $2 ] ] ] ] == $null makes sure 
    ;that you already haven't reacted to this current netsplit
    SET -u5 %split.[ $+ [ $1 [ $+ [ $2 ] ] ] ] yes
    ; this SET makes it so the script will not react twice to the same split
    echo 4 -a *** Split detected between $1 and $2

Where echo 4 -a *** Split detected between $1 and $2 is, you can put whatever command you want to do when a netsplit happens.

When I say brb - how can I change that to Be Right Back?  Back to Top

To replace text with other text, you need to use the $replace identifier, and seeing as you want to replace your own text, then we also need to use the on INPUT event. Below is an example of how this can be done:
on *:INPUT:*:{
  IF ($left($1,1) !=/) { 
    msg $active $replace($1-,brb,Be Right Back)

The IF ($left($1,1) != /) makes sure that you didn't type a comand, because if you did and that if statement was not there, you would display the command to the active window - imagine if you were identifying to nickserv!

The HALT is required. If there was no halt, then you would get two versions of what you said. You would get one with the brb changed, and you would get one without the brb changed.

If you wanted to replace multiple words, just keep adding to the $replace identifier as shown:

on *:INPUT:*: {
  IF ($left($1,1) != /) {
    msg $active $replace($1-,brb,Be Right Back,lol,Laughing Out Loud,jk,Just Kidding)

What are groups, and how can I use them?  Back to Top

The main use of groups is to turn a part of a script on or off. To put part of your script inside a group, all you need to do is put #groupname on at the start of the area you want to group. Remember to substitute #groupname for a name that suits your groups function, eg #swearkick. At the end of the area you want to group, put #groupname end.

To switch the group from ON to OFF, and vice versa, you need to use the /enable and /disable commands.
To switch a group on, type /enable #groupname.
To turn it off, type /disable #groupname.


#swearkick on
on @*:TEXT:*:#:
  IF ((fuck isin $1-) || (dick isin $1-) || (shit isin $1-)) { 
    kick $chan $nick No Swearing! 
on @*:ACTION:*:#:{
  IF (/fuck isin$1-) || (dick isin $1-) || (shit isin $1-)) { 
    kick $chan $nick No Swearing!
#swearkick end

Note how the groupname always starts in a #. If it does not, mIRC will not realise it is a group. This group is currently on (Thus the "on" at the end of the first #swearkick), but if I wanted to turn it off I would type /disable #swearkick. To switch it on again, /enable #swearkick is typed.

If you wish to know the status of a group for use in a script, $group is the identifier you should use. Its format:

If the #groupname is ON then this will return on, and if the #groupname is OFF then this will return OFF. One possible use for this is in dynamic popups.

NOTE: I suggest to use Tokens instead of isin.

Author     : SyntheroS
Function   : Group Popup Configure
Description: Let's you quickly see which groups are in effect, and wether
             they are on or off, and then change them. 
			 Also a good example of $submenu
Usage      : Simply right click in nearly any window to view the GPC popup
menu channel,status,menubar,nicklist,query {
alias group.cfg {
  IF (($1 isnum) && ($group($1))) {
    RETURN $right($group($1),-1) $+([,$group($1).status,],:,group.toggle $1)
alias group.toggle {
  $iif($group($1).status == on,.disable,.enable) $group($1)

What does "CTCP" stand for?  Back to Top

CTCP stands for Client To Client Protocol.

It is called 'Client to Client Protocol' because it is sent and interpreted by your IRC client. The IRC server has nothing to do with CTCP. It treats a CTCP message as just another /msg to someone. Unlike other commands, for example /whois.

How does CTCP work?  Back to Top

In CTCP, there are two forms of communication: COMMAND and REPLY. Commands are sent as follows:
PRIVMSG ((target):^A ((command>) ((value)^A, where
* ^A      = ASCII Character 1
* command = CTCP command
* value   = value to be processed by the target's client
And REPLIES in this format:
NOTICE ((target):^A  ((command) ((value)^A, where
* ^A      = ASCII Character 1 
* command = CTCP command
* value   = value to be processed by the target's client
For example, a ping of channel #HelpDesk would be:
PRIVMSG #helpdesk :^APING 866780265^A
This message would be received by all the people on channel #HelpDesk but yourself. They would all get this:
:Merlin`!mish@my.help.channel.com PRIVMSG #helpdesk :^APING 866780265^A
For example, a reply to this ping would be:
NOTICE Merlin` :^APING 866780265^A
This message would be received by Merlin` like this:
 :Skinner!sjm076@ppp-per-217.ca.com.au NOTICE Merlin` :^APING 866780265^A
Merlin`'s client would then interpret this as being a reply to a PING and process it accordingly, in this case, taking the timestamp (866780265) and subtracting it from the current timestamp.

CTCP commands are sent as privmsgs. CTCP replies are sent as notices.

CTCP commands and replies are in the format of

<privmsg/notice> <target>:^A<command> <arguments>^A

What are the common CTCP commands?  Back to Top


Briefly, this is what each command does:

Command Description
CLIENTINFO Display valid CTCP commands for that client.
ACTION When you type /me does this, it is actually sent as a CTCP message. However, unlike other CTCP commands, it does not require a REPLY, and none should be given.
DCC DCC is established by CTCP, however it is not conducted over CTCP. See the section on DCC for more information on this protocol.
ERRMSG Reply to unknown CTCP command.
FACE Pictographic 32x32 pixel representation of user (Macintosh clients only).
FINGER Shows idletime of client, usually with an e-mail address and message.
PING Used to measure lag, or the time it takes for information to travel between servers.
SOUND Causes the client(s) that receive it to play a sound file.
SOURCE A URL where the client/script can be obtained.
TIME Local time of recipient.
USERINFO Shows a "witty" saying set by user.
VERSION Replies with IRC client version.

How do I send a CTCP command?  Back to Top

/CTCP target command is implemented in nearly every IRC client. For those that it isn't, usually commands like /version target, /ping target, etc., are.

The exception to this is PING, which is usually done by /ping target (or /cping target in ircle).

What is a CTCP flood?  Back to Top

It is when someone maliciously makes your client reply to CTCP messages with the purpose of making you disconnect from the IRC server.

Most servers are set up to allow you receive more data than you can send; therefore some commands such as CLIENTINFO can be used to disconnect you.

The command to make your client reply to a CLIENTINFO is 12 characters (plus source/target information), while the reply to CLIENTINFO may be 100 - 200 characters. You will be disconnected with the message "Excess Flood."

What about DCC?  Back to Top

DCC is started by a CTCP command. However, once it is started, it is conducted totally independant of the IRC server. For example, to start a DCC chat connection, the originator of the request (whoever typed /dcc chat nick will send something like this:

PRIVMSG <target> :^ADCC CHAT <type> <longip> <port>^A
* ^A = ASCII Character 1 * type = Either Chat or Talk, but almost always Chat these days * longip = 32-bit Internet address of originator's machine * port = Port on which the originator is waiting for a DCC chat
The person I want to DCC chat would get this:

:Merlin`!mish@my.help.channel.com PRIVMSG SomeOne :^ADCC CHAT CHAT 3406736986 2094^A

From this, their IRC client would know that the machine with address 3406736986 is ready to accept a DCC chat connection on port 2094. The IRC client of the target of the DCC chat would then establish a connection to port 2094 of machine 3406736986 if the DCC chat was accepted.

DCC file sends are similar to DCC chat requests, but follow the format below:

PRIVMSG <target> :^ADCC SEND <filename> <longip> <port> <filesize>^A 
* ^A = ASCII Character 1 * filename = Name of file being sent * longip = 32-bit Internet address of originator's machine * port = Port on which the originator is waiitng for a DCC chat * filesize = Size of file being sent
The person I want to send a file to would get this:
:Merlin`!mish@my.help.channel.com PRIVMSG Someone :^ADCC SEND CTCP_and_DCC 3406736986 2097 4509^A

From this, their IRC client would know that the machine with address 3406736986 is ready to send a file named "CTCP_and_DCC" that is 4509 bytes long on port 2097. The IRC client of the target of the DCC send would then establish a connection to port 2097 of machine 3406736986 if the DCC send was accepted.