mIRC Home    About    Download    Register    News    Help

Print Thread
random whois #181885 01/08/07 04:55 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Is it possible to change it to whois the nicklist in alfa order from a to z ?

Code:
  
alias randomnick {
if ( %op.random == off ) || ( %op.random == $null ) { return }
if ( !$timer(randomwhois) ) { timerrandomwhois 0 60 randomnick  }
if ( $me isop #chat ) { whois $nick($v2,$rand(1,$nick($v2,0))) }
 }
}


Re: random whois [Re: Garou] #181913 01/08/07 11:17 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Warning: This will fail on a channel with lots of names and/or long nicks.

Code:
menu * {
  Alphabetical Whois : who_is $input(Channel Name,e,,$iif($chan,$v1))
}
alias -l who_is {
  if !$nick($1,$me) {    echo -a Sorry you must be in $1  }
  else {
    var %a = 1, %b = $nick($1,0)
    while %a <= %b {
      set %alpha_nicks $addtok(%alpha_nicks,$nick($1,%a),32)
      inc %a
    }
    set %alpha_nicks $sorttok(%alpha_nicks,32)
  }
  var %a = 1, %b = $numtok(%alpha_nicks,32)
  while %a <= %b {
    .enable #alpha_whois
    whois $gettok(%alpha_nicks,%a,32)
    inc %a
  }
}
#alpha_whois off
raw *:*:{
  if $numeric == 318 {
    .disable #alpha_whois
  }
  elseif $int($calc($numeric / 100)) == 3 {
    echo -s $1-
  }
}
#alpha_whois end


Re: random whois [Re: RusselB] #181933 02/08/07 04:44 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Cool....can you add a timer in it to check one every 30 sec so that I dont seft flood?

Last edited by Garou; 02/08/07 05:18 PM.
Re: random whois [Re: Garou] #181969 02/08/07 11:22 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Unnecessary...the code should not proceed to the next /whois until the current one is complete.

Re: random whois [Re: Garou] #181973 02/08/07 11:52 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
The code in fact might flood you off the server; I think the following is what RusselB had in mind: processing the next whois if the actual whois finished - thereby producing a dynamic delay without flooding too many /whois-requests at once.
Code:
menu * {
  Alphabetical Whois : who_is $input(Channel Name,e,,$iif($chan,$v1))
}

alias -l who_is {
  if (!$nick(#$1,$me)) { echo -a Sorry you must be in #$1  }
  else {
    var %a = 1, %b = $nick(#$1,0)
    while (%a <= %b) {
      set %alpha_nicks $addtok(%alpha_nicks,$nick(#$1,%a),32)
      inc %a
    }
    set %alpha_nicks $sorttok(%alpha_nicks,32)
  }
  .enable #alpha_whois
  alpha_whois
}

alias -l alpha_whois {
  whois $gettok(%alpha_nicks,1,32)
}

#alpha_whois off
raw *:*:{
  if ($numeric == 318) {
    if ($deltok(%alpha_nicks,1,32)) {
      set %alpha_nicks $v1
      alpha_whois
    }
    else { .disable #alpha_whois }
    haltdef
  }
  elseif ($int($calc($numeric / 100)) == 3) {
    echo -s $1-
    haltdef
  }
}
#alpha_whois end

I also added "haltdef", as the code already echoes the reply to the status window.

btw: the line
Code:
 elseif ($int($calc($numeric / 100)) == 3) {
is ingenious laugh

Re: random whois [Re: Horstl] #181979 03/08/07 01:30 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks, Horstl, for noting what I was trying to do (not sure why some of the code didn't post), and for the 'ingenious' compliment.

Re: random whois [Re: Horstl] #181980 03/08/07 02:14 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I get this error?
* /set: line too long (line 10, dialog62.op)

Re: random whois [Re: Garou] #181982 03/08/07 02:25 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You were warned that a channel with lots of names and/or long names might not work. That's what has happened.

The variable in that line, that's trying to be set, has reached a length greater than 950 characters. This is a known mIRC limitation. The only way that I'm aware of getting around it, is to use binary variables, but I haven't used them, and I don't know how they work.

Re: random whois [Re: RusselB] #181983 03/08/07 02:31 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I see then maybe I better keep my original random code also?
Thank you both :P

Re: random whois [Re: RusselB] #181984 03/08/07 02:44 AM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline
Fjord artisan
Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Originally Posted By: RusselB
The variable in that line, that's trying to be set, has reached a length greater than 950 characters. This is a known mIRC limitation. The only way that I'm aware of getting around it, is to use binary variables, but I haven't used them, and I don't know how they work.


It would be nice if mIRC could stop at 950 then. Anyone wrote a snippet to $calc( $len(%variable) to be 950, and then cut it off, since, mIRC doesn't?

Re: random whois [Re: LostShadow] #181994 03/08/07 04:45 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The problem with that, LostShadow, is that the number isn't exactly 950 characters.

I use 950 as a base, and most of the time it works fine, but the true limit, if I remember correctly, can be calculated as:
967 - (number of characters in variable name)

So the actual number of characters that you can have in a variable, also depends on the number of characters in the variable name.

Very few people work with variable names that are 17 characters (or more), which is why I normally use the 950.

Re: random whois [Re: Garou] #182022 03/08/07 03:38 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
This solution uses (hidden) windows to store the nicks, and filter to sort the list
Code:
menu * {
  Alphabetical Whois : who_is $$input(Channel Name,e,,$iif($chan,$v1))
}

alias -l who_is {
  if (!$nick(#$1,$me)) { echo -a Sorry you must be in #$1 to perform the alphabetical whois. }
  else {
    window -h @alphawhois.nicks
    var %nr = 1
    while ($nick(#$1,%nr)) { aline @alphawhois.nicks $v1 | inc %nr }
    window -h @alphawhois.out
    filter -wwct 1 32 @alphawhois.nicks @alphawhois.out
    window -c @alphawhois.nicks
  }
  .enable #alpha_whois
  alpha_whois
}

alias -l alpha_whois {
  if ($line(@alphawhois.out,1)) { whois $v1 }
  else {
    window -c @alphawhois.out
    .disable #alpha_whois 
  }
}

#alpha_whois off
raw *:*:{
  if ($fline(@alphawhois.out,$2,1,32)) { 
    if ($numeric == 318) {
      echo -s $str(-,15)
      dline @alphawhois.out $fline(@alphawhois.out,$2,1,32)
      alpha_whois
    }
    elseif ($int($calc($numeric / 100)) == 3) {
      echo -s $2-
    }
    haltdef
  }
}
#alpha_whois end


Re: random whois [Re: Horstl] #182031 03/08/07 05:43 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
WOW...worked fine on 125 users I only got up to a 2sec lag :P
Thank You,