MIRC script
From Free net encyclopedia
A mIRC script is a piece of code written on the scripting language included on mIRC, a popular IRC client for Windows.
Contents |
[edit]
Primary uses
- 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)
[edit]
Other uses
- MP3 players
- mIRC games
[edit]
Script storage
Scripts are stored in files, usually with a .mrc or .ini file extension. Multiple script files can be loaded at one time.
[edit]
Language features
- Built-in functions are termed commands, or identifiers if they return a value.
- Custom text-entered functions are called aliases. Aliases that return a value are known as custom identifiers. Aliases are called from the command line or other parts of a script.
- Popups are scripted context menu items. Popups are called when they are selected by the user.
- Remotes are event-handling scripts. Remotes are called when the event they handle occurs.
- All variables are dynamically typed.
- 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 chat window, they must be preceded by /, like any IRC command).
[edit]
File handling
- Scripts can read from and write to files [$read | write]
- Scripts also can copy and delete files. [copy | remove]
[edit]
Binary variables
- Contain unlimited (8192 bytes prior to mIRC 6.1) raw data
- Globally accessible via commands and identifiers
- Automatically disappear when script returns control to mIRC (and not to another part of a script)
- Prefixed with & (&VariableName)
[edit]
Hash tables
- Contain keys (which are identical to binary variables except with no prefix)
- Globally accessible via commands and identifiers
- Automatically disappear when exiting mIRC
- Not prefixed
[edit]
Global variables
- Contain 945 bytes of space-delimited data (variable names use up that space: %a can store up to 944 bytes of data and %ace can store up to 942 bytes of data)
- Cannot store NUL (ASCII 0) or consecutive spaces
- Globally accessible
- Do not automatically disappear (stored automatically in a mIRC initialization file)
- Prefixed with % (%VariableName)
[edit]
Local variables
- Contain 945 bytes of space-delimited data (variable names use up that space: %a can store up to 944 bytes of data and %ace can store up to 942 bytes of data)
- Cannot store NUL (ASCII 0) or consecutive spaces
- Accessible only by the alias that created them
- Only existing in the context of the alias that created them
- Prefixed with % (%VariableName)
[edit]
Code Example
These codes are in the aliases script format. On the remote script, the commands should be preceded by the word "alias".
Here is the Hello World code example:
hello { echo -a Hello World! }
Here is an example to count to ten:
ten { var %x = 1 while (%x <= 10) { echo -a %x inc %x } }
[edit]