From WikiChip
Editing mirc/commands/sline

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 29: Line 29:
 
<pre>/sline -r #example 1</pre>
 
<pre>/sline -r #example 1</pre>
 
<pre>/sline -r #example</pre>
 
<pre>/sline -r #example</pre>
 +
 +
= 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 ==

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)