mIRC Home    About    Download    Register    News    Help

Print Thread
#193131 15/01/08 12:28 PM
Joined: Sep 2007
Posts: 65
X
Babel fish
OP Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
Code:
on *:join:*: {
  if ( $nick == $me ) {
    var %nicks = 1
    while ( %nicks <= $nick($chan,0) ) {
      userhost $nick($chan,%nicks)
      inc %nicks
    }
  }
  else {
    userhost $nick
  }
}


I honestly can't figure what's wrong here. I've tried like.. everything. Even running it in a seperate alias. After debugging it, it would seem that it only loops once, not all the times it's supposed to.

Any ideas?

Thanks.


GamerzWoW
The Official GamerzPlanet WoW Server
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Why not just use /who ?

Code:

on *:JOIN:#: {
  if ($nick == $me) who #
}


Also, you don't need to to a /userhost on each nick that joins after you because the server sends their address when they join so they're automatically added to the IAL if it's enabled. As far as your while loop goes...

Code:

on *:JOIN:#: {
  if ($nick == $me) {
    var %nicks = 1
    while ($nick($chan,%nicks) != $null) {
      .timer 1 %i userhost $v1
      inc %nicks
    }
  }
  else userhost $nick
}



~ Edit ~
I assumed you were just filling and updating the IAL, my apologies if I was incorrect.

~ Edit ~
Correction.


Last edited by RoCk; 15/01/08 01:41 PM.
Joined: Sep 2007
Posts: 65
X
Babel fish
OP Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
I see. Alright, I'll just do it when I, myself, join. But honestly, I got kind of frustrated over why mIRC won't do this thing.

So, a person on IRC helped me a lot with testing it out, and we came to this conclusion:

Quote:
0,10 0,12 11,2 14:11:19 0,12 0,10  12[10Testarossa12] 4
 0,10 0,12 11,2 14:11:23 0,12 0,10  12[10Testarossa12] hmm
 0,10 0,12 11,2 14:11:41 0,12 0,10  12[10Testarossa12] apparently, //say $nick($chan,0) = 4 and in a script, $nick($chan,0) = 1
 0,10 0,12 11,2 14:11:53 0,12 0,10  12[10Testarossa12] var %chans = $nick($chan,0)
 0,10 0,12 11,2 14:11:53 0,12 0,10  12[10Testarossa12] while ( %nicks <= $nick($chan,0) ) {
 0,10 0,12 11,2 14:11:53 0,12 0,10  12[10Testarossa12] userhost $nick($chan,%nicks)
 0,10 0,12 11,2 14:11:53 0,12 0,10  12[10Testarossa12] echo # %nicks %chans
 0,10 0,12 11,2 14:12:00 0,12 0,10  12[10Testarossa12] and i get this:
 0,10 0,12 11,2 14:12:01 0,12 0,10  12[10Testarossa12] 0 1
 0,10 0,12 11,2 14:12:01 0,12 0,10  12[10Testarossa12] 1 1
 0,10 0,12 11,2 14:12:53 0,12 0,10  12[10XTZGZoReX12] Strange

(Sorry for the color codes.)

So, at this point, I just wonder why $nick() returns different values? It seems strange.

Edit: Even more..

Quote:
0,10 0,12 11,2 14:24:05 0,12 0,10  12[10Testarossa12] var %chans $nick(#peace,0)
 0,10 0,12 11,2 14:24:06 0,12 0,10  12[10Testarossa12] gives 1 as well


Edit2:

Quote:


~ Edit ~
I assumed you were just filling and updating the IAL, my apologies if I was incorrect.

I actually were. smile

Last edited by XTZGZoReX; 15/01/08 01:26 PM.

GamerzWoW
The Official GamerzPlanet WoW Server
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

I see the error with $nick($chan,0) when you join, sorry I missed that lol, it's because the nicklist isn't filled until after you join, so you would have to put it in an alias and call it with a timer...

Code:

on *:JOIN:#: {
  if ($nick == $me) .timer 1 5 mejoin #
  else userhost $nick
}

alias mejoin {
  var %nicks = 1
  while ($nick($1,%nicks) != $null) {
    .timer 1 %i userhost $v1
    inc %nicks
  }
}



Better yet...

Code:

on *:JOIN:#: {
  if ($nick == $me) set -eu30 $+(%,mejoin.,#) $true
  else userhost $nick
}

raw 366:*: {
  if (!$eval($+(%,mejoin.,$2),2)) return
  unset $+(%,mejoin.,$2)
  var %nicks = 1
  while ($nick($2,%nicks) != $null) {
    .timer 1 %i userhost $v1
    inc %nicks
  }
}



~ Edit ~
Correction.


Joined: Sep 2007
Posts: 65
X
Babel fish
OP Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
I see.. Is there no way it could be done inside the event? It's not that I can't use an alias but it's more convenient the other way.

Edit: Oh, I remember that you could call a timer "outside" the script. So, couldn't I use this to do the while loop after the join, so the nicklist is updated?

But meh, I'm fine with it, if it's not possible.

Thanks for the help so far.

Last edited by XTZGZoReX; 15/01/08 01:31 PM.

GamerzWoW
The Official GamerzPlanet WoW Server
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

You can't loop through the nicks from inside the JOIN event when you join because mIRC doesn't receive the NAMES reply until after the JOIN event has finished processing, so it will always be only 1 nick, yours. mIRC hasn't yet received the list of the other nicks at that point.

Joined: Sep 2007
Posts: 65
X
Babel fish
OP Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
Well, then your script above won't work either, since the alias is called inside the JOIN event and is finished before the JOIN event finishes.

So.. There doesn't really seem to be any good way to do this, other than calling it manually, after the event.


GamerzWoW
The Official GamerzPlanet WoW Server
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

I put a 5 second timer on it, that was the correction. My last one with the raw 366 would probably be the best way to do it automatically aside from just using the /who # method.

Joined: Oct 2007
Posts: 102
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2007
Posts: 102
on *:JOIN:#: {
if ($nick == $me) set -eu30 $+(%,mejoin.,#) $true
else userhost $nick
}

raw 366:*: {
if (!$eval($+(%,mejoin.,$2),2)) return
unset $+(%,mejoin.,$2)
var %nicks = 1
while ($nick($2,%nicks) != $null) {
.timer 1 5 %i userhost $v1
inc %nicks
}
}

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

?


Link Copied to Clipboard