From HandWiki - Reading time: 8 min
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
(Learn how and when to remove this template message)
|
| Paradigm | Event-driven programming, Procedural programming |
|---|---|
| Designed by | Khaled Mardam-Bey |
| Developer | Khaled Mardam-Bey |
| First appeared | 1995 |
| Typing discipline | Dynamic typing |
| OS | Microsoft Windows |
| License | Proprietary software |
| Filename extensions | .mrc, .ini |
| Website | www |
| Major implementations | |
| mIRC AdiIRC[1][2][3] | |

The mIRC scripting language (often unofficially abbreviated to "mSL"[3][4]) is the scripting language embedded in mIRC and Adiirc, IRC clients for Windows but work with WiNE for Linux.
Scripts are stored as either plain text files, usually with a .mrc file extension, or as INI files. They, however, can be stored with any extension. Multiple script files can be loaded at one time, although in some cases, one script will conflict with another and cause one or both of them to no longer work properly. The order in which in the script files are loaded may make a difference if the script functions properly or not. A (un)loader-script MUST be used for semi-large scripts to function as intended.
This section may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts, without removing the technical details. (August 2012) (Learn how and when to remove this template message) |
mIRC scripting language uses its own nomenclature to refer to language constructs. (However, whilst this can be a little confusing to newcomers, they do not impact on the functionality of mSL.)
$, binary variables are preceded by &, and other variables (whether local or global) are preceded by %. Commands and aliases are not preceded by any particular character (although when entered from a window's command line they must be preceded by the command prefix, usually /).$read(file,[args]) | /write ]The above is intended for singular access to the file. Because each time you issue $read or /write you open and close the file for access.
Multiple accesses, during a loop for instance, is best handled through /fopen, /fwrite and /fclose. Since this opens the file only once. In some cases /filter and /savebuf is an even more efficient (non scripted loop) method.
/copy | /remove]& (e.g. &Variable)/bread and /bwrite, so these variables cannot be passed onto other parts of the script% (e.g. %Variable)set command or var -g or %Variable = value notation% (e.g. %Variable)var command. var is merely an internal alias for set -l but var poses the means to declare multiple local variables on a single line (e.g. var %a = 1, %b, %c = 2)The code below is in the remote scripts format. If placed into an alias file, the command names should not be preceded by the word "alias". Test Comments include the common /* comment */ and ;comment.
Here is an example of a Hello World alias:
;Defines the alias 'hello' in the remote script
;Note: if this is placed in an alias script,
;the 'alias' part must be removed (result: hello {)
;Usage: /hello
alias hello {
;Displays(/echo) 'Hello World!' into the active window(-a)
echo -a Hello World!
}
A remote script to automatically respond to certain text
;Placed in a remote script
;When a user types Hello! in a channel,
;you answer back: Hello, [nickname]!
on *:TEXT:Hello!:#:{ msg $chan Hello, $nick $+ ! }
;When a user types Hello! in a private message,
;you answer back: Hello, [nickname]!
on *:TEXT:Hello!:?: { msg $nick Hello, $nick $+ ! }
;Here is a script which automatically gives voice to a user
;who joins a particular channel (The Bot or user should have HOP)
on *:JOIN:#?: { mode $chan +v $nick }
;A bad word script
on *:Text:die*:#: { .mode $chan +b $nick | kick $chan $nick Dont say that again }
| Wikibooks has a book on the topic of: mIRC Scripting |
sv:Mirc#MSL (mIRC Scripting Language)