mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2021
Posts: 91
Simo Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2021
Posts: 91
i have been using this small alias to search for nicks in the nicklist and it works well except it counts from 1 to 50 and again and again instead of starting with 51 in the next row of 50 and 101 in the third row of 50 and so on.

anyway to edit this to achieve that?

thanks in advance,

heres the code i use:

Code

alias NSearch {
  if ($nick(#,$me,@&~%)) || (o isin $usermode)  {
    if ($len($1) == 1 && $1 == *) { halt }
    var %o,%i = 1
    while ($nick(#,%i,r)) {
      if ( $1 iswm $v1) {
        %o = $addtok(%o,$v2,32)
      }
      inc %i
    }
    if (%o) {
      while %o {
        echo #  $regsubex($gettok(%o,1-50,32), /(\S+)/g, $+(04,$chr(44),00,$chr(32),$chr(40)) $+ \n $+ $chr(41) $+(12,$chr(44),00)\t)  
        %o = $deltok(%o,1-50,32)
      }
    }
  }
}



Joined: Nov 2021
Posts: 91
Simo Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2021
Posts: 91
debugged it a bit after recomandations of maroon

Code

NSearch {
  if ($len($1) == 1 && $1 == *) { halt }
  var %o,%i = 1
  while ($nick(#,%i,r)) {
    if ( $1 iswm $v1) {
      %o = $addtok(%o,$v2,32)
    }
    inc %i
  }
  if (%o) {
    while %o {
      echo #  $regsubex($gettok(%o,1-50,32), /(\S+)/g, $+(04,$chr(44),00,$chr(32),$chr(40))\n$chr(41) $+(12,$chr(44),00)\t)   
      %o = $deltok(%o,1-50,32)
    }
  }
}
 

it only outputs the found nicks with 1 to 50 then it starts again with 1 to 50 for the next 50 while we wanted it to continue with 51 and so forth maroon gave me some tips on irc but i couldnt figure it out

Joined: Nov 2021
Posts: 91
Simo Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2021
Posts: 91
anyway to achieve this or would that be not possible ?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
This code is significantly different than what I steered you toward, in channel. When having trouble with something, it helps to simplify things. Once it's working correctly, then to add in the bells and whistles. So to begin, just get rid of the color codes, especially because when you're pasting a regsubex into channel, it makes it hard to tell if these are blank parameters that the other person is supposed to trust contains color codes being perfectly preserved. I'm not sure if you're reverting back away from what we ended up having in channel, but when all else fails try making sure to not have stuff touching the \t and \n in a regsubex, because it doesn't work except for things like the regsubex's comma delimiter, or a parenthesis wrapping an identifier's parameters. And, the last version in channel had trouble because all those extra bells and whistles stuff were causing you to have mis-matched parenthesis

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
What did you debug exactly? Nothing. Your first and second codes are entirely the same if not for the main top if condition which has nothing to do with your issue. There's no new informations about what's wrong, AND your original description of the problem does not match reality, this is why nobody is helping you.
You should consider stop asking questions on the forums and ask them on IRC where it won't takes 3 weeks for people to figure out what's going on.

The script itself works completely fine, obviously.

What you completely failed to mention is that the loop itself and the nicknames themselves are found correctly, it is in how you display the nickname that your count starts back at 1 instead of 51, which is quite obvious since the only thing you use for that count is.. \n from $regsubex, which is always ranging from 1 to 50 (or less on last iterations).
Achieving what you want is of course entirely possible, you need to change the logic of the loop, either add a variable that increase and count it in the main count or stop looping on $gettok(,1-50) with $deltok().
Not giving you a direct answer here, please join IRC.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2021
Posts: 91
Simo Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2021
Posts: 91
the reason i wanted to keep using :

Quote
$gettok(%o,1-50,32)


is because i didnt want to have it display all found nicks in 1 line if more then 50 nicks is found to make sure it doesnt exceed RFC protocol


Link Copied to Clipboard