ASCII Table
mIRC Pastebin
Raw Numerics
User Map
User Browser
Channel Browser
Team Clan X Scripting Group Site mIRC Scripts Dot Com
IRC Junkie - IRC News Download mIRC scripts, addons and bots
 13 May @ 01:07pm. #mirc.net @ undernet. Welcome, Guest | Sign in   
   Forums       Screenshots       Scripts       Addons       Snippets       Misc       DLLs       Tutorials       Community    
   Submit form       Download mIRC       Servers.ini       IRC News       Newbie Tutorial       Challenges       Tools    
 › Tutorial: aliases
Aliases by Mentality

Aliases are a way to make long and tedious commands short, quick and simple. For example, if you use a network that supports NickServ you might not want to type /msg NickServ Identify password every time you log on. You could simply type...

/alias id msg nickserv identify password

...and in future all you have to do is type /id and mIRC will execute the command!

As you can see from above you can add aliases using the /alias command. To do this, simply use:

/alias aliasNAME commands-to-be-done-by-alias

See the example for an example! Remember that you can also add aliases to the aliases dialog without using the mIRC command. Press ALT+D. Do not add the word /alias to the start of an alias in this dialog.
You can also add aliases to the Remotes section. Press ALT+R. To make mIRC recognize an alias in this section you need to add the word 'alias' to the start of the command. For example

alias example {
  echo -a This is an example
}


Then type /example in mIRC. Make sure you delete this (File > Unload) from mIRC before you continue with the examples below otherwise they won't work.

It is important to understand how $N works in mIRC (where 'N' is a number). If you have this sentence:

This is how it works

'Then' is $1, 'is' is $2, 'how' is $3, 'it' is $4 and, yes, you guessed it, 'works' is $5. This can go on and on. If you specify a - (e.g. $N-) then that is telling mIRC to count $N and every parameter after it. So, taking our simple sentence as an example, $3- would be "how it works" as 'how' is $3 and the only words after it are "it works".

A simple alias you can make using $1 is a /j alias:

/alias /j /join $1

This is telling mIRC to join the first thing you type after /j. So if you type /j #mirc you will join #mIRC.

You can make aliases execute only if certain parameters are filled in. The help file gives a good example of that, so we'll go with that here: /give /me $$1 a $$2

Because of the $$ (There's TWO) mIRC won't execute the command unless both are given. So, if you type /give mentality nothing will happen. If you type /give mentality cookie however, you get * Nickname gives Mentality a cookie. Simple, eh?

You can also make mIRC ask for input from the user. To do this, specify a ? after the $ symbol. As a simple example, type the following in mIRC:

/alias /test /echo -a $?

After typing this type /test in mIRC. A box will popup. Type anything you want into it, then select 'OK'. You will find that the message has now been echo'd into the screen you currently have active.

You can give this box a name to let yourself, or a user of a script you're distributing, know what to put into the box. Simply add ="name" to the end of the $?. So, carrying on with our example:

/alias /test /echo -a $?="Type in what to echo"

Notice the fact that you now have a little title above the input box? :)

You can also do something else with the text you just typed, simply use ! after the $ symbol ($!). So, type in the following:

/alias /example /echo -a $?="Type in something" | echo -a $!

The | symbol means execute another command on the same line. Type /example in mIRC and type in something. You will see it echo TWICE now. That is because not only have you told mIRC to echo what you have put into the box, you also have told it to echo $! which echos what you just typed.

Removing Aliases

To remove an alias simply type /alias /aliasname. For example, to remove the aliases we've been using above, use /alias /test and /alias /example. You should see the messages:

* Removed '/example' alias
* Removed '/test' alias

If you want to add something to an alias you don't have to remove it and then re-add it, you can just go over it. For example, if you type /alias /example /echo -a test and then type /alias /example /echo -a another test you will get the message:

* Replaced '/example' alias

Overriding Aliases

Sometimes you will find a script has gone over an mIRC command. For example, some scripts disable the /remote command so that you cannot disable mIRC remotes. Do not be fooled by this, it is not complicated. A simple alias such as the following can prevent it:

/alias /remote /echo -a Sorry, you cannot turn remotes off.

Now whenever someone types /remote off (or indeed, stupidly, /remote on) they will see the message 'Sorry, you cannot turn remotes off'. To get around this, all you have to do is add a ! to the command and the default mIRC command will be used. To see what I mean, type the alias above into your mIRC and type /remote off to see the message. Now type /!remote off. You will see the 'Remote is off' message. When you add the '!' symbol the default mIRC command is used regardless of what has been aliased over it.

Always remember that it is impossible to stop people from accessing the remotes section or the scripts that they have on their computer.

For further help with Aliases you should see /help aliases in mIRC, it's a very good guide.

Contacts & Credits  /  Contributers  /  Terms and Conditions  /  Our Logos  /  Statistics  /  Report Abuse  /  Our History  /  Advertise
Link to us:

Copyright © mIRC Scripting Network 1999-2008.
If you have found a bug, please send a pmsg to wiggle or tye (pmsg).
Page compiled in 0.001s.
88 visitors online (1 registered / 87 guests).
Using GZIP Compression.
You just ate 6.16 kb of our traffic.