mIRC Home    About    Download    Register    News    Help

Topic Options
#145752 - 27/03/06 04:58 PM /hop -a
Jigsy Offline
Hoopy frood

Registered: 18/11/04
Posts: 798
Loc: I live inside your computer. S...
(Yes I did search ...)

Not really much of an idea, but something like /hop -a which makes you hop all channels you are currently on on the current network.

Thats all.
_________________________
This signature is currently out of order. We apologize for the inconvenience.

Top
#145753 - 27/03/06 05:08 PM Re: /hop -a
raZOR Offline
Hoopy frood

Registered: 06/04/05
Posts: 1009
Loc: Green Hill Zone
floods you off =)
_________________________
IceCapped

Top
#145754 - 27/03/06 06:39 PM Re: /hop -a
vexed Offline
Vogon poet

Registered: 07/02/06
Posts: 164
Code:
 hopall { 
  var %x = $chan(0) 
  while (%x) { 
    hop -c $chan(%x) 
    dec %x 
  } 
} 

Top
#145755 - 28/03/06 01:05 AM Re: /hop -a
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
That flooded me off of the network I tried it on, however, the following (which is close) did not
Code:
alias hopall {
var %a = 1
while %a <= $chan(0) {
.timer 1 %a hop -c $chan(%a)
inc %a
}
}
  

Top
#145756 - 29/03/06 04:38 AM Re: /hop -a
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
so do you mean to part all the channels you are in and hop to one other channel?

Code:
alias hopto {
  var %chanlist = $?="Input channels to hop to like #chan1,#chan2,#chan3)"
  partall
  join %chanlist
}

let me leave all I was in and join 3 others i put in the input box

Top
#145757 - 29/03/06 07:44 AM Re: /hop -a
symphony Offline
Fjord artisan

Registered: 14/01/06
Posts: 468
Loc: Mars
This will lag you, joining a number of channels all at once,
use /mjoin with a timer.
_________________________
— Excalibur on DALnet @#mIRC @#help
http://www.mirc.org

Top
#145758 - 29/03/06 08:38 AM Re: /hop -a
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
/mjoin? I'm unable to find this command in the mIRC help file.

Top
#145759 - 29/03/06 10:21 AM Re: /hop -a
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
I just guessing, but mjoin is prolly a part of a script he using, the command dosent work in my client atlest. So i wouldent think you will find it in any mirc's *.hlp files or any other default file that comes with mirc. wink
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#145760 - 29/03/06 09:36 PM Re: /hop -a
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
Quote:
This will lag you, joining a number of channels all at once,
use /mjoin with a timer.


putting aside the nonexistent command, you would have to join a lot of channels to lag, and once they were all joined you shouldnt be lagging anymore.

how many channels do you join at one time? (per network)

Top
#145761 - 29/03/06 09:48 PM Re: /hop -a
Jigsy Offline
Hoopy frood

Registered: 18/11/04
Posts: 798
Loc: I live inside your computer. S...
Code:
/hopall {
  if ($status == connected) {
    var %x = 0
    while (%x < $chan(0)) {
      inc %x 1
      if (%x == 1) {
        var %chanlist = $chan(%x)
      }
      else { var %chanlist = %chanlist $+ , $+ $chan(%x) }
    }
    part %chanlist $1-
    join %chanlist
  }
}


Guess that'll have to be my workaround for the time being ...

I suppose I'll throw this out on a limb as well

/hop #chan1,#chan2,... support?


Edited by Jigsy (29/03/06 09:52 PM)
_________________________
This signature is currently out of order. We apologize for the inconvenience.

Top
#145762 - 29/03/06 10:32 PM Re: /hop -a
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
Code:
/hopall {
  if ($status == connected) {
    var %x = 0
[color:blue] I have seen it often enough that you shouldnt use identifiers in while loops, so i made this change[/color]
var %chans = $chan(0)
    while (%x < %chans) {
      inc %x 1
      if (%x == 1) {
        var %chanlist = $chan(%x)
      }
      else { var %chanlist = %chanlist $+ , $+ $chan(%x) }
    }
[color:blue]not that it reallymatters but partall is handy[/color] 
    partall $1-
    join %chanlist
  }
}


I had done it like this
Code:
alias hopall {
  if ($status == connected) {
    var %chanC = $chan(0)
    var %i = 1
    while (%i <= %chanC) { 
      var %chans = $+(%chans,$chr(44),$chan(%i))
      inc %i
    }
    partall $1-
    join %chans
  }
}


and though it adds a needless "," to the front of the var it didn't cause a problem rejoining channels

Top
#145763 - 29/03/06 10:57 PM Re: /hop -a
jaytea Offline
Fjord artisan

Registered: 23/02/06
Posts: 546
Quote:
I have seen it often enough that you shouldnt use identifiers in while loops, so i made this change
var %chans = $chan(0)
while (%x < %chans) {


only reason not to use identifiers whose values dont change in the while loop is to make it faster, by ensuring the same identifier isnt needlessly re-evaluated every iteration.. though we all know the little bit of speed difference in this case is hardly noticable laugh however, it is shorter, and even 'faster' to loop like so:

while ($chan(%x)) {

then use $v1 in place of $chan(%x) in the rest of the loop
_________________________
"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde

Top
#145764 - 30/03/06 12:07 AM Re: /hop -a
MikeChat Offline
Hoopy frood

Registered: 12/12/02
Posts: 1245
Loc: California, doooood
while ($chan(%x)) {

this is an infinite loop as $chan(0) (the decreased value of $chan(x) is zero) you end up with all your channels in the var and then iinfinite $chan(0) appended to the end until the "* /set: line too long " error stops the loop.

Top
#145765 - 30/03/06 12:48 AM Re: /hop -a
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
It's obvious, that you'd be doing an incremental loop (start with %x = 1), if you do while ($chan(%x)) which will end when $chan(%x) is $null, meaning %x's value is one unit higher than the total amount of channels.

The only thing that matters is that you minimize the number of times the identifier is called. Like you rightfully pointed out, it's better to put the value of $chan(0) into a variable, and reference that, instead of each time making mIRC retrieve the number of channels you're on.

Aside from that, whether you loop like:

var %x = 1
while ($gettok($1-,%x,32) != $null) {
; do something with $v1
inc %x
}

or

var %x = 1, %y = $0
while (%x <= y) {
; do something with $gettok($1-,%x,32)
inc %x
}

Doesn't really make any difference. Although $gettok is referenced once more in the one where it is in the while condition, on the other hand, it doesn't have to assign $0 to a variable like in the second example. Which one you choose will certainly not be based on efficiency/speed issues, as they are of no importance here.

Cases where you'll want to be against the putting of the identifier in a while condition is those that could be avoided, and should be avoided because of the inefficiency they represent. Examples of these are: $len() or $lines(). Instead of doing something like while (%x <= $lines(file.txt)) it is advised to put the value of $lines() into a var and compare %x to this. For $lines() to work, it must open the file (this means disc access) and check how many lines there are. This is far more intensive than checking the value of a variable.

Thus here, calling $lines more than once is unjustified, and should be avoided. In the case of the $gettok, or in this thread $chan(%x) you are going to need to retrieve the value of that identifier with each iteration anyway, so whether you put it in the while condition or reference it inside the body really doesn't matter.
_________________________
Gone.

Top