From WikiChip
Difference between revisions of "mirc/commands/sline"
< mirc‎ | commands

m (bot: correcting title)
(Synopsis)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{mirc title|/sline Command}}{{mIRC menu}}
+
{{mirc title|/sline Command}}
 
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.
 
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 =
+
== Synopsis ==
<source lang="mIRC">/sline [-a|r] <#channel> <N|nick></source>
+
<source lang="mIRC">/sline [c] -artc[N] <#channel> <N|nick></source>
  
= Switches =
+
<source lang="mIRC">/sline [c] -artc[N] <@win> <N></source>
<span style="display: inline-block; width: 30px;">'''a'''</span>Causes the selection to select the new line while retaining all previous selections.
 
  
<span style="display: inline-block; width: 30px;">'''r'''</span>Removes selections from either all lines or specified line(s).
+
== 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 =
+
== Parameters ==
<span style="display: inline-block; width: 80px;">'''#channel'''</span>Specifies the window that you wish to target.
+
* '''#channel''' - Specifies the window that you wish to target.
 +
* '''N|nick''' - 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 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 ==
  
= 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:
 
 
<pre>/sline #example awesomePerson</pre>
 
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 ==
 
 
<pre>/sline #example awesomePerson
 
<pre>/sline #example awesomePerson
 
/sline -a #example John
 
/sline -a #example John
 
/sline -a #example UhOh</pre>
 
/sline -a #example UhOh</pre>
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 ''//'':
 
 
<pre>//sline # awesomePerson | sline # John | sline # UhOh</pre>
 
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:
 
  
<pre>/sline #example 1</pre>
+
<pre>/sline @win 1</pre>
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:
 
 
 
<pre>//sline #example 1 | sline -a #example 2 | sline -a #example 7</pre>
 
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:
 
 
 
<pre>//var %i = 1 | while (%i <= $nick(#,0)) { sline -a # %i | inc %i }</pre>
 
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:
 
  
 
<pre>/sline -r #example awesomePerson</pre>
 
<pre>/sline -r #example awesomePerson</pre>
This nickname is no longer highlighted in the nicklist.
 
 
Removing selection also works on line numbers:
 
  
 
<pre>/sline -r #example 1</pre>
 
<pre>/sline -r #example 1</pre>
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:
 
 
 
<pre>/sline -r #example</pre>
 
<pre>/sline -r #example</pre>
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:
 
 
<pre>/sline @example 1</pre>
 
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 ===
 
<pre>/sline @example 1</pre>
 
 
=== Multiple line selection ===
 
<pre>/sline @example 1
 
/sline -a @example 2
 
/sline -a @example 3</pre>
 
 
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 ''@window''s don't allow multi-line highlights, so we want to limit our custom alias to windows capable of multiple selections.
 
 
<source lang="mIRC">
 
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
 
    }
 
  }
 
}</source>
 
In order to use this custom alias, you would simply type ''/selectall <#/@window>''. For instance, if you were on ''#example'', you would type:
 
 
<pre>/selectall #example</pre>
 
 
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:
 
 
<source lang="mIRC">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 }
 
}</source>
 
 
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:
 
 
<pre>/seluser awesomePerson</pre>
 
 
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!
 
  
 
== See also ==
 
== See also ==

Latest revision as of 19:55, 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.

Synopsis[edit]

/sline [c] -artc[N] <#channel> <N|nick>
/sline [c] -artc[N] <@win> <N>

Switches[edit]

  • -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[edit]

  • #channel - Specifies the window that you wish to target.
  • N|nick - 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[edit]

/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

See also[edit]

v · d · e mIRC commands list

A /abook, /action, /add, /ajinvite, /alias, /aline, /ame, /amsg, /anick, /aop, /auser, /auto, /autojoin, /avoice, /away

B /background, /ban, /bcopy, /beep, /bindip, /bread, /break, /breplace, /bset, /btrunc, /bunset, /bwrite

C /channel, /clear, /clearall, /clearial, /cline, /clipboard, /close, /closechats, /closedccs, /closefserves, /closemsg, /cnick, /color, /colour, /comclose, /comlist, /commands, /comopen, /comreg, /continue, /copy, /creq, /ctcp, /ctcpreply, /ctcps

D /dcc, /dccserver, /dde, /ddeserver, /debug, /dec, /describe, /dialog, /did, /didtok, /disable, /disconnect, /dlevel, /dline, /dll, Template:mIRC/donotdisturb, /dns, /dqwindow, /drawcopy, /drawdot, /drawfill, /drawline, /drawpic, /drawrect, /drawreplace, /drawrot, /drawsave, /drawscroll, /drawsize /drawtext

E /ebeeps, /echo, /editbox, /else, /elseif, /emailaddr, /enable, /events, /exit

F /fclose, /filter, /findtext, /finger, /firewall, /flash, /flist, /flood, /flush, /flushini, /fnord, /font, /fopen, /fseek, /fsend, /fserve, /fullname, /fupdate, /fwrite

G /ghide, /gload, /gmove, /gopts, /goto, /gplay, /gpoint, /gqreq, /groups, /gshow, /gsize, /gstop, /gtalk, /gunload, /guser

H /hadd, /halt, /haltdef, /hdec, /hdel, /help, /hfree, /hinc, /hload, /hmake, /hotlink, /hop, /hsave

I /ial, /ialclear, /ialmark, /identd, /if, /ignore, /iline, /inc, /iuser

J /join

L /leave, /linesep, /links, /list, /load, /loadbuf, /localinfo, /log, /logview

M /maxdepth, /mdi, /me, /menubar, /mkdir, /mnick, /mode, /msg

N /noop, /notice, /notify

O /onotice, /omsg

P /pareline, /part, /partall, /pdcc, /perform, /play, /playctrl, /pop, /protect, /proxy, /pvoice

Q /qme, /qmsg, /query, /queryrn, /quit, /quote

R /raw, /registration, /reload, /remini, /remote, /remove, /rename, /renwin, /reseterror, /resetidle, /return, /returnex, /rlevel, /rline, /rmdir, /run, /ruser

S /save, /savebuf, /saveini, /say, /scid, /scon, /server, /set, /setlayer, /showmirc, /signal, /sline, /sockaccept, /sockclose, /socklist, /socklisten, /sockmark, /sockopen, /sockpause, /sockread, /sockrename, /sockudp, /sockwrite, /sound, /speak, /splay, /sreq, /strip, /switchbar

T /timer, /timestamp, /tip, /tips, /titlebar, /tnick, /tokenize, /toolbar, /topic /tray, /treebar

U /ulist, /unload, /unset, /unsetall, /updatenl, /url, /username, /uwho

V /var, /vcadd, /vcmd, /vcrem, /vol

W

X /xyzzy