(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.
That flooded me off of the network I tried it on, however, the following (which is close) did not
alias hopall {
var %a = 1
while %a <= $chan(0) {
.timer 1 %a hop -c $chan(%a)
inc %a
}
}
so do you mean to part all the channels you are in and hop to one other channel?
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
This will lag you, joining a number of channels all at once,
use /mjoin with a timer.
/mjoin? I'm unable to find this command in the mIRC help file.
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.
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)
/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?
/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
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
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
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
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.
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.