From WikiChip
Editing mirc/identifiers/$1-

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 1: Line 1:
{{mirc title|$1- Identifier}}The '''$1-''' identifier returns a list of argument passed to an alias or returns the text message associated with an {{mIRC|on events|mSL Events}}. $1- is also filled by the {{mIRC|/tokenize}} command, and is also given different values within the command string for $findfile and $finddir. It also is used in popups menus to reference the 1-or-more nicks highlighted in that channel.
+
{{mirc title|$1- Identifier}}The '''$1-''' identifier returns a list of argument passed to an alias or returns the text message associated with an {{mIRC|on events|mSL Events}}. $1- is also filled by the {{mIRC|/tokenize}} command.
 +
 
 +
 
 +
'''Note''': $1- is built by tokenizing the parameters/text, which means that leading/trailing/consecutive spaces are lost, see {{mIRC|$parms}}, which is the same as $1-, but preserves spaces.
 +
 
  
'''Note''': $1- is built by tokenizing the parameters/text, which means that leading/trailing/consecutive spaces are lost, see {{mIRC|$parms}}, which is the same as $1-, but preserves spaces. However the /tokenize command destroys the existing $parms string as $null without replacing it with the tokenizing of the new $1- string.
 
  
 
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.
 
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.
Line 7: Line 10:
 
You can use $0 to return the total number of words or the total number of parameters.
 
You can use $0 to return the total number of words or the total number of parameters.
  
You can append text to $1, $2 etc without using {{mIRC|$+}}, as long as your text does not contain a digit, for example:
+
You can stick text to $1, $2 etc without using {{mIRC|$+}}, as long as your text does not contain a digit, for example:
 
<syntaxhighlight lang="mirc">
 
<syntaxhighlight lang="mirc">
 
//tokenize 32 Khaled | echo -a $1's skills are impressive!
 
//tokenize 32 Khaled | echo -a $1's skills are impressive!
</syntaxhighlight>If your attached text contains a number, mIRC skips every character in your text up to the last number and use the remaining text.
+
</syntaxhighlight>If your text contains a number, mIRC skips every character in your text up to the last number and use the remaining text.
'''Note''': if the value of $1 is $null, then $null is returned, instead of the text itself
 
<source lang="mIRC">
 
//tokenize 32 Khaled xyz parm3 | echo -a $1foo2bar vs $1 $+ foo123bar and $1$2 vs $1 $+ $2 and $3test and $1-x2 but $5test is null
 
result: Khaledbar vs Khaledfoo123bar and Khaled vs Khaledxyz and parm3test and Khaled xyz parm3 but is null
 
</source>
 
  
 
'''Range'''
 
'''Range'''
Line 27: Line 25:
 
== Synopsis ==
 
== Synopsis ==
 
<pre>$1-</pre>
 
<pre>$1-</pre>
 +
 
== Properties ==
 
== Properties ==
 
None
 
None
 +
 
== Range in Token functions ==
 
== Range in Token functions ==
  
Line 44: Line 44:
 
on *:text:*:#:echo -s $nick said $1-
 
on *:text:*:#:echo -s $nick said $1-
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<source lang="mIRC">
 
Creating the space-delimited $1- by tokenizing with commas:
 
//var %a $readini($mircini,options,n4) | tokenize 44 %a | echo 4 -a %a tokenizes as $1- | echo 3 -a your dcc send port range is $13 through $26
 
</source>
 
 
<source lang="mIRC">
 
tokenizing by capital X creates tokens containing internal, trailing, leading spaces, and is not a case-insensitive tokenizing.
 
//tokenize 88 Xtest x test XXX testX | echo -a $qt($1) vs $qt($2)
 
result: "test x test " vs " test"
 
The result is the same when the leading, trailing, consecutive capital X's are removed
 
</source>
 
 
<source lang="mIRC">
 
echo removes leading/trailing/consecutive spaces from the display. Replacing spaces with codepoint 160 shows that $1- also removes those same spaces, but they're preserved in $parms. This example does not hide the original text, so you can compare the original against these values when the original contains consecutive spaces:
 
on *:TEXT:*:#:{
 
echo $chan 1- with .32 = $1-
 
echo $chan 1- with 160 = $replace($1-,$chr(32),$chr(160))
 
echo $chan parms with .32 = $parms
 
echo $chan parms with 160 = $replace($parms,$chr(32),$chr(160))
 
}
 
</source>
 
 
<source lang="mIRC">
 
$1- and $parms are different values within the command parameter for $findfile and $finddir
 
//tokenize 32 foo bar | echo 4 -a $ $+ 1 is $qt($1) and $ $+ parms is $qt($parms) - $findfile($mircdir,$nopath($mircini),0,1,echo 3 -a $ $+ 1 is a different string $1 and parms is $parms ) $chr(22) and $ $+ 1 & $ $+ parms are back to being $qt($1) & $qt($parms)
 
result:
 
$1 is a different string C:\path\mirc.ini and parms is C:\path\mirc.ini
 
$1 is "foo" and $parms is "" - 1  and $1 & $parms are back to being "foo" & ""
 
</source>
 
 
Note: even though $parms preserves consecutive spaces, a /command like /dcc send or /copy or /write loses the extra space, and either does not work, or in some cases finds the similarly named single-spaced filename.
 
 
<source lang="mIRC">
 
In a popups menu, $1 $2 etc reference the 1st, 2nd, etc nicks highlighted in a window (top to bottom), with $0 being the total number of highlighted nicks. Because this example uses $$2- it does nothing unless there are at least 2 nicks highlighted. (Using double dollar with an identifier halts the script execution if the identifier returns null
 
 
TroutSlap2!:me slaps $$1- around a bit with a GMO trout. And don't rest easy $$2- I'm coming for you too!
 
</source>
 
 
<source lang="mIRC">
 
In Options/mouse/drop, there are default entries for drag/drop of filenames from Windows Explorer or another file manager onto a nick in the nicklist. "*.wav:/sound $1 $2-" means that files matching that wildcard execute the SOUND command, where $1 is the nick receiving the drop and $1- is the filename enclosed in doublequotes. This $parms also includes the nick, so if you need a space-preserved filename, you must do something similar to:
 
 
//var %a nick "test $chr(32) filename.wav" | var -s %a2 $remove($mid(%a,$calc(1+$pos(%a,$chr(32)))),"),$chr(32),$chr(160)
 
</source>
 
 
<source lang="mIRC">
 
Because $ has special meaning in regex, $1 in the replacement term must be evaluated with [ ] or placed in a variable, as even $eval($1,2) won't work:
 
//tokenize 32 foo bar | var %a $1 | echo -a $regsubex(foo bar,( $+ $1 $+ ),new $qt( [ $1 ] ) )
 
//tokenize 32 foo bar | var %a $1 | echo -a $regsubex(foo bar,( $+ $1 $+ ),new $qt(%a) )
 
</source>
 
  
 
== Compatibility ==
 
== Compatibility ==
 
{{mIRC compatibility|2.1a}}
 
{{mIRC compatibility|2.1a}}
 +
 
== See Also ==
 
== See Also ==
 +
 +
[[Category:mIRC identifiers|1-]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)