mIRC Homepage
Posted By: AWEstun Channel Name List - 05/05/08 04:07 PM
How would I go about using the channel name list to message everyone hello? Lets say I join a channel and I want to msg everyone hello. I have a vague idea to use a While loop.
Posted By: xyzzy Re: Channel Name List - 05/05/08 04:37 PM
Code:
alias heyall { var %x = $nick(#,0) | var %y | while %x { if $nick(#,%x) != $me { %y = $addtok(%y,$nick(#,%x),32) } | dec %x } | say %y $1- }

type /heyall urmsg < try that in a channel
Posted By: AWEstun Re: Channel Name List - 05/05/08 05:33 PM
Well, I was looking for some sort of process that I could use for something else. I was just using the msg hello as an example.
Posted By: Riamus2 Re: Channel Name List - 05/05/08 10:11 PM
You can /notice #chan something if you want. Keep in mind that a LOT of channels will ban you for mass messaging. It's better to just send a message to the channel. Why send it individually to everyone anyhow?

Code:
on me:*:join:#: {
  msg $chan Hello everyone.
}
Posted By: starbucks_mafia Re: Channel Name List - 05/05/08 10:31 PM
Well the basic code for performing something on everyone on a channel is as follows:
Code:
var %i = 1, %nick
while $nick(#channel, %i) {
  %nick = $v1
  ; Do something here with the variable %nick
}
Posted By: AWEstun Re: Channel Name List - 06/05/08 04:50 AM
Thanks, this is what I want to do:

Code:
ON *:JOIN:#:{
    names #
    ; 5-10 second delay here for channel population from /names #
    var %i = 1, %nick
    while $nick($chan, %i) {
      %nick = $v1
      echo -s %nick
      var %i = $calc(%i + 1)
    }
}


Notice that I added:

Code:
var %i = $calc(%i + 1)


How do I code a delay?
Posted By: RusselB Re: Channel Name List - 06/05/08 08:15 AM
Use
Code:
raw 366:*:{
    var %i = 1, %nick
    while $nick($2, %i) {
      echo -s $v1
      inc %i
    }
}

raw 366 will only be sent at the end of a /names command, which is sent automatically when you join a channel

The proper method of increasing a variable controlling a while loop is to use the inc command.
Posted By: AWEstun Re: Channel Name List - 06/05/08 08:31 AM
Thanks.

This IRC server that I'm on is a modified server. When you join a room all you see is yourself on the list until you do a /names #.

RAW 353 gives the /names list on this modified server.
Posted By: RusselB Re: Channel Name List - 06/05/08 08:38 AM
With a modified server, nothing we give you can be guaranteed to work, as the IRC protocols seem to be, if not ignored, at least avoided.
With that additional information, try adding this to my previous code
Code:
on me:*:join:# names $chan


Raw 353 returns the names, but raw 366 comes after all of the names have been returned. This is IRC protocol

For more references to raws, check mIRC.net Raws
Posted By: AWEstun Re: Channel Name List - 06/05/08 09:38 AM
This is what I see in debug when I join a channel:

<- :irc.private.com 353 awestun = #999=1 :awestun jason kelly matt
<- :irc.private.com 366 awestun #999=1 :End of /NAMES list.

So it be RAW 366 and the code would be:

Code:
on me:*:join:# names $chan

raw 366:*:{
    var %i = 1, %nick
    while $nick($2, %i) {
      echo -s $v1
      inc %i
    }
}


Great news! It works! Thanks!
Posted By: Tomao Re: Channel Name List - 07/05/08 08:08 AM
I've changed it to whois, but is it possible to delay the process by a couple of seconds? What it does now is to whois everybody in one shot. This increases the risk of being flooded out.

Code:
raw 366:*: {
  var %i = 1,%nick
  while $nick($2,%i) {
    whois $v1
    inc %i
  }
}
Posted By: AWEstun Re: Channel Name List - 07/05/08 08:17 AM
Here is what I'm using now:

Code:
on me:*:join:# names $chan

raw 366:*:{
    var %i = 1, %nick
    while $nick($2, %i) {
      trace $v1
      inc %i
    }
}


When I join a channel, everyone gets traced. The problem is if a channel has more than about 30 people on it, I get flooded offline. Say like a channel has 50 users, is there a way to run the 'while' loop 10 times then pause, then 10 more, then pause, etc. until all users on the channel name list are traced.
Posted By: RusselB Re: Channel Name List - 07/05/08 08:47 AM
Give this a try.. it worked on the normal networks that I have access to the /trace command on, and based on what you've said so far, it should work on your network also.
Code:
on me:*:join:#:{
  unset $+(%,nick.cnt,$chan)
  names $chan
}
raw 365:*:{
  inc $+(%,nick.cnt,$3)
  set $+(%,nicks,$($+(%,nick.cnt,$3),2)) $remove($gettok($1-,2,58),~&@%+)
}
raw 366:*:{
  var %a = 1, %b = $($+(%,nick.cnt,$2),2)
  while %a <= %b {
    var %nicks = $($+(%,nicks,%a),2)
    var %c = 1
    while %c <= $numtok(%nicks,32) {
      .timer -m 1 $calc(%c * 250) trace $gettok(%nicks,%c,32)
      inc %c
    }
    inc %a
  }
}
Posted By: AWEstun . - 07/05/08 12:50 PM
I'll give it a try.
Posted By: AWEstun Re: Channel Name List - 07/05/08 01:18 PM
It's not working for me. I see the names listed in the status window though. I changed the RAW from 353 to 365 and added an echo :

Code:
raw 365:*:{
  echo 4 -s 1: $1  2: $2  3: $3  4: $4-
  inc $+(%,nick.cnt,$3)
  set $+(%,nicks,$($+(%,nick.cnt,$3),2)) $remove($gettok($1-,2,58),~&@%+)
  echo 4 -s nick.cnt: %nick.cnt  nicks: $nicks


Echo's show:

1: awestun 2: = 3: #999=1 4: awestun bobby sam
nick.cnt: nicks:

Debug shows:

<- :irc.private.com 690 awestun #999=1 awestun H other_stuff
<- :irc.private.com 353 awestun = #999=1 :awestun bobby sam
<- :irc.private.com 366 awestun #999=1 :End of /NAMES list.

Looks like I need to use RAW 353 instead of RAW 365 and var $4???
Posted By: Tomao Re: Channel Name List - 07/05/08 06:30 PM
Code:
on me:*:join:#: { names $chan }

raw 366:*: {
  var %i = 1,%nick
  while $nick($2,%i) {
    .timer -m 1 $calc(%i * 2500) trace $v1
    inc %i
  }
}


The script works well now with a pause in a few seconds and in between every trace. I take a line from RusselB's suggestion. Thanks to him.
Posted By: AWEstun Re: Channel Name List - 07/05/08 06:47 PM
Thanks.
© mIRC Discussion Forums