From Scriptwiki
Jump to: navigation, search

<aliasname> [-l] <commands>

mIRC allows you to create aliases and scripts to speed up your IRC session or to perform repetitive functions more easily.


alias testing {
 echo -a Hello world!

And with some identifiers:

alias calculator {
 echo -a $1- = $calc($1-)

Using Aliases

-l switch

Using -l switch makes the alias local, so it can only be accessed by aliases/events in the same file, and cannot be used as a command in editbox.

alias -l testing { return Hello world! }
;typing //echo -a $testing in the editbox will result in: * /echo: insufficient parameters 
;let's put this alias into the same file:

alias localtest { echo -a $testing }
;now typing /localtest will echo "Hello world!" into active window
;if we put the localtest alias into a different file, we'll get the "* /echo: insufficient parameters" again.


$prop identifier returns custom properties for your alias ($change_case(hello world).upper -> $prop will return 'upper').

alias change_case {
 if ($prop == upper) { return $upper($1-) | halt }
 elseif ($prop == lower) { return $lowe($1-) | halt }
 else { return $1- }
;//echo -a $change_case(HeLLo WorlD!).lower will echo: 'hello world!'
;//echo -a $change_case(HeLLo WorlD!).upper will echo: 'HELLO WORLD!'


$isid identifier will return $true if the alias was called as an identifier

alias testing {
  if ($isid) { return Hello world! }
  else { echo -a Hello world! }
;both //echo -a $testing and /testing will result in echoing "Hello world!"

;if we did only:
alias testing {
  echo -a Hello world!
;that would echo "Hello world!", and then give "* /echo: insufficient parameters"


$show returns $true if the alias was NOT called with . to make it silent, and $false if it was

alias testing {
 if ($show) { 
   msg MyBot auth Myusername $1
 else {
   .msg MyBot auth Myusername $1
;/testing PASSWORD -> will show in active: '-> *MyBot* auth Myusername PASSWORD'
;/.testing PASSWORD -> won't show anything, since the msg was also made silent