|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
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.
I registered; you should too.
|
|
|
|
Joined: Nov 2006
Posts: 143
Vogon poet
|
Vogon poet
Joined: Nov 2006
Posts: 143 |
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
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
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.
I registered; you should too.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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?
on me:*:join:#: {
msg $chan Hello everyone.
}
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Well the basic code for performing something on everyone on a channel is as follows: var %i = 1, %nick
while $nick(#channel, %i) {
%nick = $v1
; Do something here with the variable %nick
}
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
Thanks, this is what I want to do: 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: How do I code a delay?
I registered; you should too.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Use 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.
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
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.
I registered; you should too.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
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 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
Last edited by RusselB; 06/05/08 08:40 AM.
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
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: 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!
I registered; you should too.
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
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. raw 366:*: {
var %i = 1,%nick
while $nick($2,%i) {
whois $v1
inc %i
}
}
Last edited by Tomao; 07/05/08 08:09 AM.
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
Here is what I'm using now: 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.
I registered; you should too.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
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. 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
}
}
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
I registered; you should too.
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
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 : 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???
I registered; you should too.
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,129 |
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.
|
|
|
|
Joined: May 2008
Posts: 329
Fjord artisan
|
OP
Fjord artisan
Joined: May 2008
Posts: 329 |
I registered; you should too.
|
|
|
|
|