Difference between revisions of "Category:Aliases"

From Scriptwiki
Jump to: navigation, search
(added to stubs)
(First part, additions will be a quick look at $isid and /return)
Line 1: Line 1:
{{stub}}
+
== Basic ==
mIRC allows you to create aliases and ...
+
mIRC script allows you to create your own set of commands and identifiers, refered to as aliases. Aliases can be called from the command line, from other aliases, from popup and from remote scripts. An alias in mIRC can not be called recursively. They can be created by either putting them in the <nowiki>"Aliases"</nowiki> section of the mIRC Scripts Editor or by using the /alias command from either the command line or in the <nowiki>"Remote"</nowiki> section of the Scripts Editor. Creating an alias in the command line results in it being placed in the "Aliases" section of the Script Editor.
 +
 
 +
=== Example ===
 +
; this is placed in the "Aliases" section
 +
moo { [[echo]] -ag moo }
 +
 +
; the is placed in the "Remote" section
 +
[[alias]] moo { [[echo]] -ag moo }
 +
 
 +
== Naming aliases ==
 +
You can give an alias virtualy any name you want, but keep a few things in mind:
 +
 
 +
* When you give an alias used as a command the same name as an existing mIRC command, your alias gets preference.
 +
* When you give an alias used as an identifier the same name as an existing mIRC identifier, mIRC's identifier gets preference.
 +
 
 +
== Aliases: parameters and events ==
 +
mIRC script allows you to pass parameters to your aliases, just like you pass parameters into built-in mIRC commands or identifiers. They can be referred to as $1, $2 ... $N.
 +
 
 +
=== Parameters ===
 +
[[alias]] moo { echo -ag m $+ [[$str]](o,$$1)
 +
 
 +
Assuming you pass a number as parameter this would echo an <nowiki>"m"</nowiki> folowed by a number of <nowiki>"o's"</nowiki>, depending on the number you specified as parameter. This alias can be called in 2 different ways:
 +
/moo 12
 +
$moo(27)
 +
Note that $moo doesn't return anything in this case, it will simply echo the message.
 +
 
 +
=== Events ===
 +
When calling an alias from an event, the identifiers related to that event will still be available in that alias.
 +
on *:TEXT:hi:#: { myAlias }
 +
 +
[[alias]] myAlias { [[msg]] [[$chan]] [[$nick]] said hi!
 +
 
 +
This would be exactly the same as:
 +
on *:TEXT:hi:#: { [[msg]] [[$chan]] [[$nick]] said hi!
 +
This in turn means that you don't have to pass a identifier supplied by an event into your alias as parameter.
  
 
[[Category:mIRC_Help]]
 
[[Category:mIRC_Help]]

Revision as of 17:23, 10 April 2006

Basic

mIRC script allows you to create your own set of commands and identifiers, refered to as aliases. Aliases can be called from the command line, from other aliases, from popup and from remote scripts. An alias in mIRC can not be called recursively. They can be created by either putting them in the "Aliases" section of the mIRC Scripts Editor or by using the /alias command from either the command line or in the "Remote" section of the Scripts Editor. Creating an alias in the command line results in it being placed in the "Aliases" section of the Script Editor.

Example

; this is placed in the "Aliases" section
moo { echo -ag moo }

; the is placed in the "Remote" section
alias moo { echo -ag moo }

Naming aliases

You can give an alias virtualy any name you want, but keep a few things in mind:

  • When you give an alias used as a command the same name as an existing mIRC command, your alias gets preference.
  • When you give an alias used as an identifier the same name as an existing mIRC identifier, mIRC's identifier gets preference.

Aliases: parameters and events

mIRC script allows you to pass parameters to your aliases, just like you pass parameters into built-in mIRC commands or identifiers. They can be referred to as $1, $2 ... $N.

Parameters

alias moo { echo -ag m $+ $str(o,$$1)

Assuming you pass a number as parameter this would echo an "m" folowed by a number of "o's", depending on the number you specified as parameter. This alias can be called in 2 different ways:

/moo 12
$moo(27)

Note that $moo doesn't return anything in this case, it will simply echo the message.

Events

When calling an alias from an event, the identifiers related to that event will still be available in that alias.

on *:TEXT:hi:#: { myAlias }

alias myAlias { msg $chan $nick said hi!

This would be exactly the same as:

on *:TEXT:hi:#: { msg $chan $nick said hi!

This in turn means that you don't have to pass a identifier supplied by an event into your alias as parameter.

Pages in category "Aliases"

The following 7 pages are in this category, out of 7 total.