Site hosted by Angelfire.com: Build your free website today!

 

INTRO TO MIRC SCRIPTING BY EL SYSOP CHIPO (optional)

 

GO BACK TO MAIN PAGE.

 

Introduction to mIRC scripting

This tutorial is assuming that the user knows a little about the IRC client mIRC and is working under the Windows operating system. This tutorial also assumes that the user knows basic IRC commands, like for example, "/join" and "/part" also knowing how to identify yourself to Nickserv or an equivalent is helpful. If you need to learn any of these commands to be able to continue a good resource is to simply go into the mIRC help section. You can do this by hitting 'help' at the top of your client.

Aliases

Anyway... Beyond these basics (first of all) lies the Aliases screen. Open the aliases screen up now, by clicking on the green /a button towards the top of the mIRC screen (above where your status tab lies). You should see a whole bunch of commands already in this aliases section which may start off looking something like this:



However, not all mIRC clients will have these commands already placed here, and you may be adding your first command in about 2 minutes.

First of all, it might be easier if I take you through EXACTLY what a simple command (or script, if you like) will look like and what it is used for. Take this example:



The first part, /j is what you will actually type into your mIRC client either in the status tab, after you've connected to a server, or in a channel itself. As soon as you've typed /j mIRC will join you to the channel #help, because you've told your client that once /j is entered, you want to join the channel #help!

By the way, to be able to get this command to work correctly, it's obviously logical to type the script "/j /join #help" into the aliases screen, ON A NEW LINE! Then hit save.

REMEMBER: You must enter every command on a new line so that the script can be read from left to right, downwards. Else it wont understand what you are asking it to do!

Now that you understand the format, I'll tell you how to add a command which may prove a little bit more useful. :-)

Parameters

Something which you will need to understand before I go on to the layout of the next command, is:



It means, basically, first parameter which, even more simply, means, the first thing you type AFTER the actual command. ($ is an identifier) To demonstrate what I mean, I'll use the above example to show you how you can use one command to join the specified channel.



Where $1 is the channel that you type after '/j' So for example, after I've added that script to my aliases section, and saved it. I would type in my mIRC client, "/j #help" and my IRC client would automatically join me to channel #help.

These basic script commands, are just an example of what you can do. Here are some more script commands that could be used:



The list goes on :-)

More...

Now, what if you want to write another simple script which would allow you to do 2 actions consecutively?

Braces are required now. I will show you an example of a script which I sometimes use to allow me to quit every channel I am in on a server then join one (or 2) others. (I've lately had problems with my connection since I have a tendancy to join way too many channels than I need to be in!)

 



This is an example which most mIRC scripting tutorials should give you, and I've actually found it quite useful. In the example, there are 2 new things to figure out. The first, is the use of braces around the 2 commands. These are to show your client that you want to run BOTH commands at around the same time (there are some problems with this, which I will point out later) Anyway, opening the braces after you've told your client how you want to recognise the command are opened, then the /partall command is used to part every channel you are currently in. Then the /join $1 $2 will mean that after you've parted the channels you are in, you will join the 2 channels you ask to join. ($2 means the second parameter).

You will need to type into your client, "/go #help #chat". Obviously, you will then part all channels, and join #help and #chat.

The problem that I found with this script, is that if you are currently in the 2 channels you want to re-join your client will have trouble parting the channel you want to join!

In this tutorial, I will sometimes give example which, on seperate lines may have a semi colon then a message after it. When the script runs, it will ignore all information which is on the same line as the semi colon. For example:



You can write whatever you like after the semi colon, so long as YOU understand it!

In my next example, I will use $1- which means, the first parameter AND everything you want to include after that! So, it may be used when you want to send someone a query message. Take this example to demonstrate my point:



This example would allow you to send a query to a nick then all the parameters you send IN the message. So, you would type:



$?

There are, of course, alternatives to using the $1 identifiers. Perhaps another of the quite useful, is the $? identifier, which logically means... well, whatever you want it to mean! If you use $? in a /join alias, as the example I've shown above, then your mIRC client will ask you what channel you want to join. The $? identifier is placed in the alias, in exactly the same way as the $1 and $2 identifiers are.

There are also identifiers like $me and $chan which mean your current nickname and your current channel. To put some of these new commands into practise, I'll use an example which will allow you to kick yourself (probably not the BEST example... but, still!) from the channel you are currently in:



This is very simple... Your asking your mIRC client to kick yourself from the channel you have open. Remember that the $1- at the end of the script allows you to write a kick message. (Maybe if you kick yourself from a channel, you will want to explain WHY! :-p)

Anyway, these are the very basic commands which you will need to learn in order to create useful mIRC scripts.

 

GO BACK TO MAIN PAGE.