m |
m |
||
Line 146: | Line 146: | ||
= Conclusion = | = 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! | 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! | ||
+ | |||
+ | == See also == | ||
+ | * [[List of commands - mIRC|List of commands]] | ||
+ | * [[/window command - mIRC|/window]] | ||
+ | * [[Custom Windows - mIRC|Custom Windows]] | ||
+ | |||
+ | [[Category:mIRC commands]] |
Revision as of 22:08, 22 June 2014
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.
Synopsis
/sline [-a|r] <#channel> <N|nick>
Switches
aCauses the selection to select the new line while retaining all previous selections.
rRemoves selections from either all lines or specified line(s).
Parameters
#channelSpecifies the window that you wish to target.
N|nickTells mIRC which line you wish to select, either in the form of a line number (N) or a nickname (nick). Note: This parameter is not necessarily required when the -r switch is invoked.
Examples
There's no better way to understand a command, or any aspect of anything for that matter, than with good old-fashioned practice. Let's review a few different scenarios.
Selecting by nickname
Let's say that you're on a channel called #example, and you want to select someone's nickname, we'll call them awesomePerson, in the nicklist. How would you do that? Simple! You would use the /sline command. You would simply type in the channel the following command:
/sline #example awesomePerson
You will notice that the awesomePerson nickname is now highlighted/selected within the channel's nicklist. Pretty neat, huh?
Some more options would be if you wanted to select more than one user. Using our same channel as above, #example, suppose you want to select awesomePerson, John, and UhOh. The simplest way to tackle this is to use the -a flag, which tells the /sline command to retain any previous selections.
Selecting multiple lines
/sline #example awesomePerson /sline -a #example John /sline -a #example UhOh
You will notice that all three nicknames have now been highlighted within the nicklist. There is a simpler way you can do this with a single line. All you would need to do is utilize the double forward-slash feature //:
//sline # awesomePerson | sline # John | sline # UhOh
The outcome here will be the same as the above. Remember, using the double forward-slash causes mIRC to evaluate everything thereafter, which is why the pipes are valid, and also why you don't need anymore slashes for the rest of the /sline commands.
Selecting by line number
Alright, so what if you just want to select a line number in the nickname list? This is extremely easy:
/sline #example 1
The above example selects the first nickname in the #example channel. If you want to select multiple line numbers, we can use our double forward-slashed shortcut from above in order to select any lines we want:
//sline #example 1 | sline -a #example 2 | sline -a #example 7
You will notice that we went from line 2 to line 7. mIRC will process this accordingly and select lines 1, 2, and 7.
What if you want to select all lines in a channel's nickname list? This is easily accomplished with another double forward-slash shortcut:
//var %i = 1 | while (%i <= $nick(#,0)) { sline -a # %i | inc %i }
Wow, that was fast, huh? mIRC quickly selects each and every nickname within the nicklist!
Removing Selections
Removing selections is relatively easy. All you do is invoke the -r command and let mIRC know which line you want to remove the selection from. Using the #example channel from above, and our friend awesomePerson, let's say we grow tired of having his name selected and therefore want to remove selection highlight from his nickname. The following example accomplishes this task:
/sline -r #example awesomePerson
This nickname is no longer highlighted in the nicklist.
Removing selection also works on line numbers:
/sline -r #example 1
This will remove the selection highlight from the first nickname in the #example channel nicklist.
The awesome thing about the -r switch is that, unlike the -a switch, if you want to remove all selections, you only need to use it without any parameters. Here is an example:
/sline -r #example
This will remove all selections from all nicknames in the #example channel.
Custom @windows
You already know the basics of how channel selections work, how to select multiple nicknames, and how to remove selections. But, what if you want to make line selections within custom @windows? Fortunately, mIRC provides this functionality as well.
Note: Normal @windows, ones that are not created using the -l switch to make them list windows, only support selections based on line numbers, not specific text in a line. Furthermore, regular @windows can only select a single line, not multiple lines.
Alright, let's say you have a window, /window @example, and inside that window you have about 100 lines of text. Utilizing /sline, we select any line by using the same technique as the numeral selection from our channel window example above:
/sline @example 1
This selects the first line in our custom @example window. The first thing you will notice about this normal @window selection is that the line selected does not highlight like the nicklist selections do. This is normal behavior, so don't panic.
Alright, now a list-styled window, /window -l @example, is the same thing, except in this case we can select multiple lines at a time, and the lines do highlight!
Single line selection
/sline @example 1
Multiple line selection
/sline @example 1 /sline -a @example 2 /sline -a @example 3
A quick note that's worth mentioning is that these commands are all based off of the edit box from within mIRC, not within the script editor.
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!