From WikiChip
Editing mirc/aliases
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 51: | Line 51: | ||
'''Note:''' Aliases from the aliases tab can freely call aliases from the remote tab and vice versa. | '''Note:''' Aliases from the aliases tab can freely call aliases from the remote tab and vice versa. | ||
− | |||
− | |||
− | |||
=== Aliases Prefixes === | === Aliases Prefixes === | ||
Line 62: | Line 59: | ||
You can prefix your command call by a dot '.' to prevent mIRC from displaying its typical message, such as {{mIRC|/timer|.timer}}. | You can prefix your command call by a dot '.' to prevent mIRC from displaying its typical message, such as {{mIRC|/timer|.timer}}. | ||
− | |||
− | |||
===== ! prefix (built-in call) ===== | ===== ! prefix (built-in call) ===== | ||
Line 70: | Line 65: | ||
==== Identifier Prefixes ==== | ==== Identifier Prefixes ==== | ||
− | |||
− | |||
− | |||
− | |||
===== / and . prefix (custom call) ===== | ===== / and . prefix (custom call) ===== | ||
Line 81: | Line 72: | ||
===== ~ prefix (built-in call) ===== | ===== ~ prefix (built-in call) ===== | ||
− | In essence, such a call to an identifier will only look at built-in | + | In essence, such a call to an identifier will only look at built-in identifier, custom aliases won't be searched for. |
− | This will bypass the Identifier Warning message but it's a bit unclear why this is useful, it can | + | This will bypass the Identifier Warning message but it's a bit unclear why this is useful, it can allows you to check if an identifier exist in mIRC's own language and has a value but you cannot use it to check built-in which would return $null then, and you have to execute the function, checking for "$findfile" or "$zip" would be problematic. |
===== ! prefix (delay evaluation) ===== | ===== ! prefix (delay evaluation) ===== | ||
Line 92: | Line 83: | ||
Given the alias prefixes above, you cannot start the name of an alias with a command prefix if you are going to call it as a command, same idea for identifier. | Given the alias prefixes above, you cannot start the name of an alias with a command prefix if you are going to call it as a command, same idea for identifier. | ||
+ | === Commands vs. Identifiers === | ||
+ | in mSL, aliases can serve as both '''identifiers''' and '''commands'''. These two terms are used to describe the type of alias it is. In general, a '''command''' will usually not return anything but simply process some type of data. An '''Identifier''' on the other hand will generally return some kind of a value. | ||
== Commands == | == Commands == | ||
Line 230: | Line 223: | ||
echo %text | echo %text | ||
} | } | ||
− | </source> | + | </source lang> |
Because an alias is not re-entrant, using 'echo' inside an alias of the same name cannot be intercepted by that same alias, though it can be trapped by another alias named echo, unless this alias calls it like !echo. This does not completely trap all colors, because it does not remove the color from "/echo -c ctcp message". | Because an alias is not re-entrant, using 'echo' inside an alias of the same name cannot be intercepted by that same alias, though it can be trapped by another alias named echo, unless this alias calls it like !echo. This does not completely trap all colors, because it does not remove the color from "/echo -c ctcp message". | ||
Line 310: | Line 303: | ||
<h3 id="shortcuts">Shortcuts and Function Keys</h3> | <h3 id="shortcuts">Shortcuts and Function Keys</h3> | ||
− | Aliases can be used to redefine function keys and shortcuts by simply renaming them the actual key or key combinations. For the F-keys all you need is to name the actual alias F1 through F12. C | + | Aliases can be used to redefine function keys and shortcuts by simply renaming them the actual key or key combinations. For the F-keys all you need is to name the actual alias F1 through F12. C and S can be used for the Shift and Ctrl Key. For example SF1 is Shift+F1 keys. |
For Example: | For Example: | ||
− | < | + | <syntaxhighlight lang="mIRC">alias SF1 { |
echo -a Shift+F1 was pressed! | echo -a Shift+F1 was pressed! | ||
− | } | + | }</syntaxhighlight> |
− | |||
− | |||
− | |||
− | |||
− | </ | ||
== Local Aliases == | == Local Aliases == | ||
Line 348: | Line 336: | ||
The order used by mIRC to locate your alias is as follow: | The order used by mIRC to locate your alias is as follow: | ||
− | * | + | * If the name exists as a built-in $identifier, your alias cannot be called as an identifier unless you use the . or / prefixes as described above. If the name exists as a built-in /command, it cannot execute your alias if the ! command prefix is used as describe above. |
− | * if the call is made from a script and there is | + | * if the call is made from a script and there is a local alias for that name in the script file, that alias is used |
− | * if none of the above is true, then the order in which you loaded the script is used. mIRC looks for the first non local alias in the order 1-or-more aliases files in the Alt+D tab of the script editor, followed by the scripts of the Alt+R tab in the order they're loaded. If you have the same alias name defined twice in the same file, the 2nd one cannot be executed. | + | * otherwise, if the call is made from a script and there is a non local alias for that name in the same script file, that alias is used (see the note) |
+ | * if none of the above is true, then the order in which you loaded the script is used. mIRC looks for the first non local alias in the order 1-or-more aliases files in the Alt+D tab of the script editor, followed by the scripts of the Alt+R tab in the order they're loaded. If you have the same non-local alias name defined twice in the same file, the 2nd one cannot be executed. If you have the same non-local alias defined in 2 different script files, it's possible to change that order from the script editor's menu (file/order). | ||
* If none is found, then mIRC check if this is a built-in command name | * If none is found, then mIRC check if this is a built-in command name | ||
− | * If still no match | + | * If still no match, then it sends the command to the server, which sends back RAW numeric 421 if it's an invalid server command |
+ | |||
+ | '''Note:''': The command line of a timer behaves as if it's inside the script from where it was launched. It can execute local aliases within that script, and give preference to non-local aliases located in that same script. The alias on a higher scriptline is executed regardless whether the top or bottom alias is -l local. | ||
− | '''Note | + | [maroon edit: this next paragraph doesn't make sense to me, but i want other opinions before i change it] |
+ | '''Note''': This means that local aliases only guarantees no other script file can call the alias, they does not help making sure that alias is called if a code in the same script file calls your alias: a non local alias also guarantees the alias is called if it's in the same script file, the order in which you loaded the script won't matter. | ||
== See also == | == See also == |