Misplaced Pages

MIRC scripting language: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editContent deleted Content addedVisualWikitext
Revision as of 18:20, 28 July 2010 editLordMaster96 (talk | contribs)67 editsNo edit summary← Previous edit Latest revision as of 00:50, 29 December 2024 edit undoRJFJR (talk | contribs)Administrators155,382 edits top: link 
(90 intermediate revisions by 66 users not shown)
Line 1: Line 1:
{{short description|Scripting language embedded in mIRC}}
{{multiple issues|
{{more footnotes|date=August 2012}}
{{prose|date=August 2012}}
}} <!-- not too technical for users of mIRC. Definitely NOT ], too long, too long. (lyrics to something). Needs to be prose. -->
{{lowercase|title=mIRC Scripting Language}} {{lowercase|title=mIRC Scripting Language}}


Line 4: Line 9:
| name = mIRC Scripting Language | name = mIRC Scripting Language
| file_ext = .mrc, .ini | file_ext = .mrc, .ini
| paradigm = ], ] | paradigm = ], ]
| year = {{Start date|1995}} | year = {{Start date|1995}}
| designer = Khaled Mardam-Bey | designer = ]
| developer = Khaled Mardam-Bey | developer = Khaled Mardam-Bey
| typing = ] | typing = ]
| implementations = ] | implementations = ] ]<ref>
{{cite web
| title = Features - AdiIRC - AdiIRC Support/Bugs/Feature Requests
| url = https://dev.adiirc.com/projects/adiirc/Features#26-Scripting-Engine
| publisher = Per Amundsen
| access-date = 2 December 2020
| archive-url = https://web.archive.org/web/20201202144248/https://dev.adiirc.com/projects/adiirc/Features#26-Scripting-Engine
| archive-date = 2 December 2020
}}</ref><ref>{{cite web
| title = Scripting - AdiIRC - AdiIRC Support/Bugs/Feature Requests
| url = https://dev.adiirc.com/projects/adiirc/Scripting#mIRC-scripting-compatibility
| publisher = Per Amundsen
| access-date = 2 December 2020
| archive-url = https://web.archive.org/web/20201202145150/https://dev.adiirc.com/projects/adiirc/Scripting#mIRC-scripting-compatibility
| archive-date = 2 December 2020
}}</ref><ref name=Slant>{{cite web
| title = mIRC vs AdiIRC detailed comparison as of 2020 - Slant
| url = https://www.slant.co/versus/4185/4195/~mirc_vs_adiirc
| publisher = Parli, Inc.
| access-date = 2 December 2020
| archive-url = https://web.archive.org/web/20201202151151/https://www.slant.co/versus/4185/4195/~mirc_vs_adiirc
| archive-date = 2 December 2020
}}</ref>
| operating_system = ] | operating_system = ]
| license = ] | license = ]
| website = | website = {{URL|https://www.mirc.com/}}
}} }}


] ]
The '''mIRC scripting language''' (often unofficially abbreviated to "'''mSL'''"{{R|Slant}}<ref>{{citation
The '''mIRC scripting language''', abbreviated as MSL, is the ] embedded in ], a popular ] client for ].
| title = mIRC Scripting Language - WikiChip
| url = https://en.wikichip.org/mirc#article-title
| publisher = WikiChip LLC
| archive-url = https://web.archive.org/web/20201112031552/https://en.wikichip.org/MIRC#article-title
| archive-date = 12 November 2020
}}</ref>) is the ] embedded in ] and ], ] clients for ] but work with ].


==Primary uses== ==Primary uses==
*Channel and personal protection against any types of attacks (flooding, spamming, CTCP floods, etc) *Light channel and personal protection against many types of attacks (flooding, spamming, takeovers, etc.).
*Dialog windows can be created in mIRC to better serve user-compatibility. *Dialog windows can be created in mIRC to better serve user-compatibility; rather than everything in popup menus.
**Popular mIRC dialog extensions include MDX ('''M'''irc '''D'''ialog '''Ex'''tension) and DCX ('''D'''ialog '''C'''ontrol '''Ex'''tension) There are also a few versions of mdx.dll and dcx.dll modded by irc hackers. **Popular mIRC dialog extensions include MDX ('''m'''IRC '''D'''ialog '''Ex'''tension) and DCX ('''D'''ialog '''C'''ontrol '''Ex'''tension). There are also a few versions of mdx.dll and dcx.dll modded by IRC hackers.
*]s that provide automated IRC channel management, trivia or other games, and other desired functions for chatters *]s that provide automated IRC channel management, trivia or other games, and other desired functions for chatters.
*Commands that save typing or otherwise simplify life on IRC (such as automatically ] as the owner of a nickname) *Commands that save typing or otherwise simplify life on IRC (such as automatically ] as the owner of a nickname).
*Proxy '''CONNECT''' servers (www.mslscript.com) and '''Bounce''' servers (https://en.wikipedia.org/ZNC) to replace '''some''' mSL scripting with faster code and convenient features.


==Script storage== ==Script storage==
Scripts are stored as either plain text files, usually with a .mrc ], or as ]s. They however can be stored with any extension. It can be: .exe, .script, etc. Scripts are stored as either plain text files, usually with a .mrc ], or as ]s. 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.
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.


==Language features== ==Language features==
{{Technical|section|date=August 2012}}
mIRC scripting involves a peculiar nomenclature that is not entirely consistent with most of the rest of the programming world. (Most notably, the term identifier—which in most languages refers to the name of a variable or function (whether it returns a value or not)—in mIRC refers specifically to a value returning function.)
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.)


*Built-in functions are termed '''commands''' or, if they return a value, '''identifiers'''. *Built-in functions are termed '''commands''' or, if they return a value, '''identifiers'''.
*Custom scripted ]s are called '''aliases'''. Aliases that return a value are known as '''custom identifiers'''. Both are called from the command line or other parts of a script in the same ways as built-in commands and identifiers (and can even supersede them). *Custom scripted ]s are called '''aliases'''. Aliases that return a value are known as '''custom identifiers'''. Both are called from the command line or other parts of a script in the same ways as built-in commands and identifiers (and can even supersede them).
*'''Popups''' are scripted ] items. Popups are called when they are selected by the user. The term originally referred to the menus—which pop up upon a right click. It is still used this way in the manual. But the user community (who tend not to read scripting manuals) took to calling the individual items popups—perhaps thinking of the colourful novelty actions that are popular with many users as pages of a popup book. *'''Popups''' are scripted ] items. Popups are called when they are selected by the user. The term originally referred to the menus—which pop up upon a right click. It is still used this way in the manual.
*Remotes are ] scripts. Remotes are called when the event they handle occurs. *Remotes are ] scripts. Remotes are called when the event they handle occurs.
*All variables are ]. *All variables are ].
*]s are available for larger data storage; ]s are not.
*mIRC scripts make use of ]. Identifiers (whether custom or built-in) are preceded by <code>$</code>, binary variables are preceded by <code>&</code>, and other variables (whether local or global) are preceded by <code>%</code>. 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 <code>/</code>). *mIRC scripts make use of ]. Identifiers (whether custom or built-in) are preceded by <code>$</code>, binary variables are preceded by <code>&</code>, and other variables (whether local or global) are preceded by <code>%</code>. 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 <code>/</code>).


Line 49: Line 84:
*Globally accessible via commands and identifiers *Globally accessible via commands and identifiers
*Automatically unset when script returns control to mIRC (and not to another part of a script) *Automatically unset when script returns control to mIRC (and not to another part of a script)
*Prefixed with <code>&</code> (eg. <code>&Variable</code>) *Prefixed with <code>&</code> (e.g. <code>&Variable</code>)
*Cannot be accessed other than by <code>/bread</code> and <code>/bwrite</code>, so these variables cannot be passed onto other parts of the script *Cannot be accessed other than by <code>/bread</code> and <code>/bwrite</code>, so these variables cannot be passed onto other parts of the script


Line 67: Line 102:
*Globally accessible *Globally accessible
*Do not automatically unset unless a switch is used (stored automatically in a mIRC initialization file) *Do not automatically unset unless a switch is used (stored automatically in a mIRC initialization file)
*Prefixed with <code>%</code> (eg. <code>%Variable</code>) *Prefixed with <code>%</code> (e.g. <code>%Variable</code>)
*Created using the <code>set</code> command or <code>var -g</code> or <code>%Variable = value</code> notation *Created using the <code>set</code> command or <code>var -g</code> or <code>%Variable = value</code> notation


Line 74: Line 109:
*Can store NUL (ASCII 0) or trailing spaces *Can store NUL (ASCII 0) or trailing spaces
*Are destroyed when the triggered alias or event ends *Are destroyed when the triggered alias or event ends
*Prefixed with <code>%</code> (eg. <code>%Variable</code>) *Prefixed with <code>%</code> (e.g. <code>%Variable</code>)
*Created using the <code>var</code> command. <code>var</code> is merely an internal alias for <code>set -l</code> but <code>var</code> poses the means to declare multiple local variables on a single line (e.g. <code>var %a = 1, %b, %c = 2</code>) *Created using the <code>var</code> command. <code>var</code> is merely an internal alias for <code>set -l</code> but <code>var</code> poses the means to declare multiple local variables on a single line (e.g. <code>var %a = 1, %b, %c = 2</code>)


==Limitations== ==Limitations==
*mIRC's scripting parser only supports a maximum of 4,150 (950 prior to mIRC 6.32) characters per line (not including newlines or indentation). *Scripting parser supports a maximum of 8,292 (950 prior to mIRC 6.32) characters per line (not including newlines or indentation).
*Strings are not syntactically enclosed, creating ambiguities in code where characters meant as literal strings are treated as part of the language's ]. *Strings are not syntactically enclosed, creating ambiguities in code where characters meant as literal strings are treated as part of the language's ].
*Each line of code is broken down into a set of space-delimited tokens. As mIRC's parser does not support null tokens and the language doesn't provide a syntax to clearly differentiate literal strings from code; Prior to mIRC version 6.2 it was impossible to pass multiple consecutive spaces to any command or alias. However, this was fixed with the introduction of the returnex command which allows the preservation of spaces. *Each line of code is broken down into a set of space-delimited tokens. As mIRC's parser does not support null tokens and the language doesn't provide a syntax to clearly differentiate literal strings from code; Prior to mIRC version 6.2 it was impossible to pass multiple consecutive spaces to any command or alias. However, this was fixed with the introduction of the returnex command which allows the preservation of spaces.
Line 85: Line 120:
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 "<code>alias</code>". Test Comments include the common <code>/* comment */</code> and <code>;comment</code>. 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 "<code>alias</code>". Test Comments include the common <code>/* comment */</code> and <code>;comment</code>.


Here is an example of a ] alias: Here is an example of a ] alias:


<source lang="mirc"> <syntaxhighlight lang="autoit">
;Defines the alias 'hello' in the remote script ;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 {) ;Note: if this is placed in an alias script,
;the 'alias' part must be removed (result: hello {)
;Usage: /hello ;Usage: /hello

alias hello { alias hello {


Line 98: Line 135:


} }
</syntaxhighlight>
</source>

Counting to 10:

<source lang="mirc">
alias ten {

;'%i' is locally set as 1
var %i = 1

;The while loop continues until '%i' is greater than 10, then stops.
while (%i <= 10) {

;Displays(/echo) '' into the active window(-a)
;'' will be 1 at the beginning of the execution.
echo -a %i

;To continue the while loop, '%i' must be increased, or you'll
;have yourself an infinite loop (can be broken with Ctrl+Pause/Break)
inc %i

;Don't forget to close the while loop scope.
}
}
</source>

A remote script event handler:

<source lang="mirc">
;Placed in a remote script.

;Literally: when any user joins #IRCHelp, message to the channel: Hello
on *:JOIN:#IRChelp: { msg $chan Hello $nick }

;To do this for any channel, the code would be:
on *:JOIN:#: { msg $chan Hello $nick }
</source>


A remote script to automatically respond to certain text A remote script to automatically respond to certain text


<source lang="mirc"> <syntaxhighlight lang="autoit">
;Placed in a remote script ;Placed in a remote script


;When a user types Hello! in a channel, you answer back: Hello, ! ;When a user types Hello! in a channel,
;you answer back: Hello, !

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


;When a user types Hello! in a private message, you answer back: Hello, ! ;When a user types Hello! in a private message,
;you answer back: Hello, !

on *:TEXT:Hello!:?: { msg $nick Hello, $nick $+ ! } on *:TEXT:Hello!:?: { msg $nick Hello, $nick $+ ! }
</source>


;Here is a script which automatically gives voice to a user
Here is an example of picture windows:
;who joins a particular channel (The Bot or user should have HOP)


on *:JOIN:#?: { mode $chan +v $nick }
<source lang="mirc">
alias cir {


;A bad word script
;Create a picture (-p) window (@cir)
window -pek @cir


on *:Text:die*:#: { .mode $chan +b $nick | kick $chan $nick Dont say that again }
;Draw a circle (on window @cir) with color 4 (red), size of 50 at coordinates (200,200)
</syntaxhighlight>
drawdot @cir 4 50 200 200

}
</source>


==See also== ==See also==
* ] * ]
* ] * ]

==References==
{{Reflist}}
<!-- This are discussions in several books of the mIRC scripting language. Notable over a period of years. To be converted to inline citations.-->
* Smith, Chris. (2004). . Paul Mutton, ed. O'Reilly Media, Inc. pp.&nbsp;71–74. ''(In-depth example of script features and usage)''
* Jose Nazario (2004). Artech House, 2004. p.&nbsp;53, 55. ''(Discusses 1997 mIRC script attack.)''
*Ken Dunham, Jim Melnick (2008) . CRC Press. p.&nbsp;7-31. ''(In-depth analysis/reverse engineering of mIRC-script-based malware bot)''
* ] (2005). . Pearson Education. Ch. 3.7.7.
* David Harley, Robert S. Vibert (2007). . Elsevier. p.&nbsp;147. (usage in script attacks)
*Esharenana E. Adomi (2008). . Idea Group Inc (IGI). p.&nbsp;173.
*Markus Jakobsson, Zulfikar Ramzan. (2008). . Addison-Wesley Professional. p.&nbsp;194.


==External links== ==External links==
{{wikibooks|mIRC Scripting}}
<!--========================({{No More Links}})============================ <!--========================({{No More Links}})============================
| PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. WIKIPEDIA | | PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. WIKIPEDIA |
Line 179: Line 191:
| and link back to that category using the {{dmoz}} template. | | and link back to that category using the {{dmoz}} template. |
=======================({{No More Links}})=============================--> =======================({{No More Links}})=============================-->
* *
* *
* &nbsp;— A Wiki-based user-maintained help reference primarily for mIRC scripting
*
* &nbsp;— documentation in single-page HTML format
* {{Dmoz|Computers/Software/Internet/Clients/Chat/IRC/mIRC/Scripts|mIRC Scripts}}


{{IRC footer}} {{IRC footer}}


{{DEFAULTSORT:Mirc Scripting Language}}
]
] ]


]
]
]
]
] ]

Latest revision as of 00:50, 29 December 2024

Scripting language embedded in mIRC
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations. (August 2012) (Learn how and when to remove this message)
This article is in list format but may read better as prose. You can help by converting this article, if appropriate. Editing help is available. (August 2012)
(Learn how and when to remove this message)


mIRC Scripting Language
ParadigmEvent-driven programming, Procedural programming
Designed byKhaled Mardam-Bey
DeveloperKhaled Mardam-Bey
First appeared1995 (1995)
Typing disciplineDynamic typing
OSMicrosoft Windows
LicenseProprietary software
Filename extensions.mrc, .ini
Websitewww.mirc.com
Major implementations
mIRC AdiIRC
mIRC scripts editor (built-in)

The mIRC scripting language (often unofficially abbreviated to "mSL") is the scripting language embedded in mIRC and Adiirc, IRC clients for Windows but work with WiNE for Linux.

Primary uses

  • Light channel and personal protection against many types of attacks (flooding, spamming, takeovers, etc.).
  • Dialog windows can be created in mIRC to better serve user-compatibility; rather than everything in popup menus.
    • Popular mIRC dialog extensions include MDX (mIRC Dialog Extension) and DCX (Dialog Control Extension). There are also a few versions of mdx.dll and dcx.dll modded by IRC hackers.
  • Bots that provide automated IRC channel management, trivia or other games, and other desired functions for chatters.
  • Commands that save typing or otherwise simplify life on IRC (such as automatically identifying as the owner of a nickname).
  • Proxy CONNECT servers (www.mslscript.com) and Bounce servers (https://en.wikipedia.org/ZNC) to replace some mSL scripting with faster code and convenient features.

Script storage

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.

Language features

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 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.)

  • Built-in functions are termed commands or, if they return a value, identifiers.
  • Custom scripted functions are called aliases. Aliases that return a value are known as custom identifiers. Both are called from the command line or other parts of a script in the same ways as built-in commands and identifiers (and can even supersede them).
  • Popups are scripted context menu items. Popups are called when they are selected by the user. The term originally referred to the menus—which pop up upon a right click. It is still used this way in the manual.
  • Remotes are event-handling scripts. Remotes are called when the event they handle occurs.
  • All variables are dynamically typed.
  • Hash tables are available for larger data storage; arrays are not.
  • mIRC scripts make use of sigils. Identifiers (whether custom or built-in) are preceded by $, 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 /).

File handling

  • Scripts can read from and write to files ) | /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.

  • Scripts can also copy and delete files.

Binary variables

  • Contain unlimited (8192 bytes prior to mIRC 6.1) raw data
  • Globally accessible via commands and identifiers
  • Automatically unset when script returns control to mIRC (and not to another part of a script)
  • Prefixed with & (e.g. &Variable)
  • Cannot be accessed other than by /bread and /bwrite, so these variables cannot be passed onto other parts of the script

Hash tables

  • May contain unlimited binary data or up to 4,150 (950 prior to mIRC 6.32) bytes of plain text. This limit is imposed by mIRC's scripting parser's own line length limitation (unless assigning a binary variable)
  • Globally accessible via commands and identifiers
  • Automatically unset when exiting mIRC as they are only stored in memory
  • Can be saved for later use
  • Not prefixed
  • Faster than accessing from a file, as hash tables are stored in memory rather than the hard disk
  • Size limited only by the computer's memory limits.
  • Allows any bucket size to be used

Global variables

  • May contain up to 4,150 (950 prior to mIRC 6.32) bytes of data including its name (however due to line-length limitations in mIRC's scripting parser, a maximum of 4,146 bytes can be assigned explicitly using /set or /var — this number decreasing as the variable's name grows longer)
  • Cannot store NUL (ASCII 0) or trailing spaces
  • Globally accessible
  • Do not automatically unset unless a switch is used (stored automatically in a mIRC initialization file)
  • Prefixed with % (e.g. %Variable)
  • Created using the set command or var -g or %Variable = value notation

Local variables

  • May contain up to 4,150 (950 prior to mIRC 6.32) bytes of data including the variable name (however due to line-length limitations in mIRC's scripting parser, a maximum of 4,146 bytes can be assigned explicitly using the /set or /var commands — this number decreasing as the variable's name grows longer)
  • Can store NUL (ASCII 0) or trailing spaces
  • Are destroyed when the triggered alias or event ends
  • Prefixed with % (e.g. %Variable)
  • Created using the 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)

Limitations

  • Scripting parser supports a maximum of 8,292 (950 prior to mIRC 6.32) characters per line (not including newlines or indentation).
  • Strings are not syntactically enclosed, creating ambiguities in code where characters meant as literal strings are treated as part of the language's syntax.
  • Each line of code is broken down into a set of space-delimited tokens. As mIRC's parser does not support null tokens and the language doesn't provide a syntax to clearly differentiate literal strings from code; Prior to mIRC version 6.2 it was impossible to pass multiple consecutive spaces to any command or alias. However, this was fixed with the introduction of the returnex command which allows the preservation of spaces.

Code examples

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, !
on *:TEXT:Hello!:#:{ msg $chan Hello, $nick $+ ! }
;When a user types Hello! in a private message,
;you answer back: Hello, !
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 }

See also

References

  1. "Features - AdiIRC - AdiIRC Support/Bugs/Feature Requests". Per Amundsen. Archived from the original on 2 December 2020. Retrieved 2 December 2020.
  2. "Scripting - AdiIRC - AdiIRC Support/Bugs/Feature Requests". Per Amundsen. Archived from the original on 2 December 2020. Retrieved 2 December 2020.
  3. ^ "mIRC vs AdiIRC detailed comparison as of 2020 - Slant". Parli, Inc. Archived from the original on 2 December 2020. Retrieved 2 December 2020.
  4. mIRC Scripting Language - WikiChip, WikiChip LLC, archived from the original on 12 November 2020

External links

Internet Relay Chat (IRC)
Common terms
Related protocols
Networks
Technology
See also
Clients
macOS
Microsoft Windows
Unix-like
Cross-platform
Multi-IM
Web-based
Web browser components
Library and plug-ins
Category
Category: