| free hosting image hosting hosting reseller online album e-shop famous people | ||
![]() ![]() |
||

Hackers introduction to mIRC scripting
This tutorial doesn't teach "hacking". It teaches mIRC scripting in a very quick and dirty manner. ENJOY!!!
Why learn mIRC Scripting?
mIRC scripting is very easy. Of course this is not the only reason why you might want to learn. Many mIRC scripts are available online and many offer useful features, but this is the exception. Most mIRC script packages have things that you don't need, things that are banned by IRC servers, and things that make you look like a script kiddie, even if your not. You can also write scripts that stop kiddies from destroying your chatting/idling experience.
Why do so many scripts suck?
Often scripts are written by high school kids, who want to show off their knowledge and make themselves known. They try to do this by making scripts that play mp3's and advertise themselves through the CTCP replies, quit messages, and other ways, dirtying your mIRC to such a point where it become unrecognizable, unliked, and getting you into all sorts of trouble.
Types of scripts found on the net
mIRC scripting structure
There are different kinds of mIRC scripts, there are aliases, there are remote scripts and there are popup files. Each of these types of scripts have a unique purpose and niche to fill.
Aliases
Aliases are commands that you create yourself. You can make an alias in a remote script or in an alias script, where they are typically found. You can use any commands in alias that you would usually use in mIRC.you should keep the mIRC help file close to you at all times, since most operations occur using commands. here is an example of an alias that changes your nickname to your nickname to _away. In other words, it just adds _away to your nickname.
nickaway {
nick $me $+ _away
}WHAT WHAT WHAT?
$me is an identifier, it is simply a function that returns a value. If $me was a C++ function, it might look like this:
string me() {
return myNickName;
}$+ is a binary operand that allows you to concatenate strings. We have to do this since IRC does not allow spaces in nicknames.
There are many identifiers, i will list a few here:
$mircdir - The directory where th mirc executable is located
$time - The system time
$network - The network you are connected to , if any
$1- Arguments passed to command delimited by spaces
$gettok - Tokenizer identifier
$calc(expr) - used to do calculations
$eval(stmt) - Control how many times a tstament is evaluated(his is very usefull)Always dig in the mIRC help file to find what your looking for. There are many identifiers
Variables
Creating variables in mIRC is easy, but there are some things you need to keep in mind. mIRC does not have namespaces, scope or any of the things you can expect form most other programming langauges. I name my variables in a fake namespace, as shown in the third example below.
%var = value
var %variable = value
%dummynamespace.variable = whatever
set %variableName 38475Note that var does create a variable in it's current scope, although i don't know to what extent. experiment, because it seems that I might be wrong about some of these cases above.
Events
mIRC has events, which allows your scripts to react to certain events. Events are very similar to events in VB.net and in wxWidgets code, or any event driven library in C++.You can only respond to some events and you cannot create your own, unlesss you use the on signal event, which is an event which you trigger. Each event has it's own identifiers, so that you can see what it is that ahppend. Here is an exmaple of a ON START event.
on *:START:{ .signal -s sevent Startup }This event will be triggered when mIRC is started. every event is preceded by ON, the * could have been any number, or this wildcard. This indicates which user level one must have to activate the event. In this case that wont have any effect, so I used a *. You can for instance use ON msg event, and make your friends be able to suck files from you :). Event levels are a whole different topic that is explained in the mIRC documentation.
The . prefix of the command in the previous example allows the command to execute silently. Here is the signal event that I triggered:
on *:signal:sevent:{ if ($hget(sounds.tht,$1 $+ ON) == 1) && ($isfile($hget(sounds.tht,$1))) && ($hget(sounds.tht,$1)) { splay $ifmatch } }This event just plays a sound if it is contained within the sounds.tht table, and the sound file exists. Hashtables are like associative arrays, and can easily be written to file. You can also use $writeini or $readini, to use the windows INI format to store information.
Some important notes:
variables remain after mIRC exits,although it is recommended not to assume that a variable exists
Popups
In the mIRC script editor go to popups, here you can select the different popups in mIRC, and thereby create new menu entries for your script. How a popup works:
name of popup:command
a submenu
.a submenu item:echo do nothing
.another submenu item:echo do more nothing at $time
.-A - is a menu separator. You can use any identifiers commands and aliases you created in a popup file. Her is an example of a menu that allows you to do some chanserv operations:
Chanserv
.Op me:opme #
.De op me:dopme #
.Unban me:unbanme #
.-
.View access List:.msg chanserv levels # listIn the above menu # will be replaced by the active channel.The opme/dopme/unbanme aliases are aliases i created to do the chanserv commands, here they are as they were in the aliases.ini file
opme msg chanserv op $1 $me
dopme msg chanserv deop $1 $me
unbanme msg chanserv unban $1 $meA remote script
Remote scripts allow you to do some nifty stuff, here is a little script i wrote that changes my system volume using words. you can use the command by typing /vo high, and it will make your volume high, full is for full volume,low for low volume and mute for mute, but you can use it in any way for instance:
/vo full volume please - this is valid, it sets the mp3 volume, which is usually the pcm volume.;============quickvol alias vo { %voOrVol = $vol(mp3) %voCheck = 0 %newVol = 0 if (ful isin $1-) { %newVol = 65500 inc %voCheck } if (hi isin $1-) { %newVol = 49149 inc %voCheck } if (med isin $1-) { %newVol = 32766 inc %voCheck } if (lo isin $1-) { %newVol = 16383 inc %voCheck } if (mut isin $1-) { %newVol = 0 inc %voCheck } if (%voCheck > 1) { //echo -a 4[ Ambiguous Command ] halt } else { vol -p %newvol } }Explanation.
Well $vol(mp3) gets the current system volume. vol -p sets the new volume, inc increments a variable value. The halt command stops the running script. The ;==== is just a comment by the way.
Loading a remote scriptLets take the above script, which i have put into a file for you which you can get here.
You can also use while loops in mIRC:
%myVar = 1
while (%myVar <= 10) {
echo -a %myVar
inc %myVar
}
You can make aliases that assign commands to your F keys:
alias sF1 { join #toilet }
alias F5 { quit see you later losers }
alias scF2 { echo -a you pressed shift+ctrl+F2 }
You can make a long command span multiple lines:
echo -a This is a very very very very very very very very $&
veryvery very very very very very very very long line of text $&
and im doing it in multiple lines
You can make a custom identifier, simple by using return
alias myIdendifier {
return $me : $time
}echo -a $myIdentifier
if you want a command to take arguments you can do it like so:
alias runCPL {
run $1- $+ .cpl
}
With this alias try /runCPL desk
Dialogs
you can make dialogs in mIRC. there are some limitations though. You cant make a resizable frame.
dialog myDialog {
title "My Simple dialog "
size -1 -1 300 150
option dbu
check "Do something ", 16, 118 99 39 10, flat
text "A text control ", 1, 12 31 70 8
text "Another text control ", 3, 12 17 52 8
button "Add", 4, 44 119 31 9, flat}
You use the on dialog event to capture mouse clicks etc. To create a control you specify it as such:
type value, ID, position size, style
ID's are very important because they allow you to identify which control activated an event
Here is an example:
on *:dialog:myDialog:sclick:4:{
echo -s $dialog $devent $did
}
ClosingThis tutorial is a mess I know, but it is intended to be a little trivial. mIRC scripting is really easy and there isn't much to explain. I hope that you found it at least a little useful, and remember, the mIRC documentation is where you will find the rest. Please don't go writing lame scripts now :). Here are some usefull aliases for you to ponder on:
alias downloads {
run $+(",$mircdir,download,")
}alias runWinamp {
run $+(",$getenv(programfiles),\,winamp\winamp.exe,")
}