(→Examples) |
(→Parameters) |
||
Line 13: | Line 13: | ||
* '''-c[N]''' - Same as using the [c] parameter to change the color, but via a switch | * '''-c[N]''' - Same as using the [c] parameter to change the color, but via a switch | ||
− | = Parameters = | + | == Parameters == |
<span style="display: inline-block; width: 80px;">'''#channel'''</span>Specifies the window that you wish to target. | <span style="display: inline-block; width: 80px;">'''#channel'''</span>Specifies the window that you wish to target. | ||
<span style="display: inline-block; width: 80px;">'''N|nick'''</span>Tells mIRC which line number you wish to select, if using a channel window, you can pass a nickname to be matched against and that line number will be used | <span style="display: inline-block; width: 80px;">'''N|nick'''</span>Tells mIRC which line number you wish to select, if using a channel window, you can pass a nickname to be matched against and that line number will be used | ||
+ | == Examples == | ||
<pre>/sline #example awesomePerson | <pre>/sline #example awesomePerson |
Revision as of 19:51, 17 March 2023
The /sline command is used to select a line, or a specific set of lines, in a specific window. This command works on most custom @windows, as well as channel nickname lists.
Contents
Synopsis
/sline [c] -artc[N] <#channel> <N|nick>
/sline -artc[N] <@win> <N>
Switches
- -a - Causes the selection to select the new line while retaining all previous selections
- -r - Removes selections from either all lines or the Nth line (cannot unselect specific multiple lines at once).
- -t - forces a re-wrap of all lines in a window that have not yet been wrapped to the current window size.
- -c[N] - Same as using the [c] parameter to change the color, but via a switch
Parameters
#channelSpecifies the window that you wish to target.
N|nickTells mIRC which line number you wish to select, if using a channel window, you can pass a nickname to be matched against and that line number will be used
Examples
/sline #example awesomePerson /sline -a #example John /sline -a #example UhOh
/sline @win 1
/sline -r #example awesomePerson
/sline -r #example 1
/sline -r #example
Code
Why don't we go ahead and take a look at a custom alias command that highlights all lines in a specific window? Furthermore, let's also add some error checking to make sure the window that is specified is either a channel or a list window. Why would we do that? Well, because normal @windows don't allow multi-line highlights, so we want to limit our custom alias to windows capable of multiple selections.
alias selectall { ; Let's make sure the specified window is either a ; channel or a listbox window. if (($window($1).type == listbox) || ($1 ischan)) { ; Since we made sure that we are dealing with a ; channel or listbox window, %m, or maximum line ; variable, is now set to how many lines are ; available in the window that is passed to the ; alias. var %i = 1, %m = $iif($1 ischan,$nick($1,0),$line($1,0)) ; Our loop that makes sure that our counter is ; less than the maximum amount of lines in the ; specified window. while (%i <= %m) { ; Add to the currently selected lines sline -a $1 %i inc %i } } }
In order to use this custom alias, you would simply type /selectall <#/@window>. For instance, if you were on #example, you would type:
/selectall #example
And there you have it, a remarkably easy example showing the power of /sline. What's that? You want a usefuller script of some sort? Alright! :)
A usefuller script of some sort
I'm not exactly sure what the heck a usefuller' script of some sort is, but I'll do my best. Let's say you're in multiple channels, and you want to select the nickname of someone who is also in some of those channels (they don't have to be in any of them, or even all of them; even just one is fine). How would we do this? Simple:
alias seluser { ; Create our temporary variables. The %c ; variable stores the amount of channels we ; are on. This is for our loop. The %n ; variable stores the nickname that has ; been passed to the alias. var %c = $chan(0), %n = $1 ; Now, we simply loop through each channel ; and pass along our /sline command in ; order to select the specified nickname. while (%c) { sline $chan(%c) %n | dec %c } }
In order to use this, you would simply type /seluser <nickname>. So, for instance, say we wanted to select the nickname awesomePerson on all channels that we are in, we would type:
/seluser awesomePerson
It's a good time to mention that if the nickname does not exist on that channel, or even any channels, mIRC won't produce an error; the script will simply continue on to the next loop iteration.
Conclusion
Now that you've seen some of the more uncommon ways that even something as simple as /sline can be utilized, you'll understand why many of mIRC's features go overlooked. Simply practice and you will be on your way to being an mSL guru in no time!