From WikiChip
$1- Identifier - mIRC
< mirc‎ | identifiers
Revision as of 19:38, 14 January 2018 by Ouims (talk | contribs)

The $1- identifier returns a list of argument passed to an alias or returns the text message associated with an mSL Events. $1- is also filled by the /tokenize command.

Note: $1- is built by tokenizing the parameters/text, which means that leading/trailing/consecutive spaces are lost, see $parms, which is the same as $1-, but preserves spaces.

If $1- represents the full line/parameters, you can use $1 to only reference the first parameter/word, you can use $2 to reference the second parameter/word and so on.

You can use $0 to return the total number of words or the total number of parameters.

You can stick text to $1, $2 etc without using $+, as long as your text does not contain a digit, for example:

//tokenize 32 Khaled | echo -a $1's skills are impressive!
If your text contains a number, mIRC skips every character in your text up to the last number and use the remaining text.

Range

$1- returns the full line/parameters because '-' is actually used to set a range.

By adding a number after the '-' character, you can get multiple consecutive word/parameter, $1-2 returns from the first word/parameter to the second word/parameter.

So $1- means from the first word/parameter to the last/parameter, aka from the first word onward and $3- is from the third word/parameter onward.


Range in Token functions

When using certain Tokens function such as $gettok, you can sometimes use a range for the N parameter, in this case you can specify a range too, but with an extra feature, both number can be negative.

Negative numbers means that mIRC looks from the end instead of the start:

 $gettok(A B C D E F,-1,32) returns B, the first word starting from the end
 $gettok(A B C D E F,-2-,32) returns E F, from the second word starting from the end, and then the last '-' means 'onward' as usual
 $gettok(A B C D E F,-2--5,32) returns B C D E, from the second word starting from the end, to the 5th word, starting from the end


Synopsis

$1-

Properties

None

Examples

on *:text:*:#:echo -s $nick said $1-

Compatibility

Added: mIRC v2.1a
Added on: 28 Feb 1995
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also