mIRC Homepage

Message To All

Posted By: PunkDud3

Message To All - 07/11/05 07:57 PM

How do I send private message to all people in a channel ?

And btw it is not for spamming purpose if that is what you mean.

smile
Posted By: SladeKraven

Re: Message To All - 07/11/05 08:27 PM

Code:
alias all {
  var %x = $nick($active,0)
  while (%x) {
    if ($1) $1 $nick($active,%x) $2-
    dec %x
  }
}


/all notice Some notice.
/all msg Some message.
/all query

-Andy
Posted By: Riamus2

Re: Message To All - 07/11/05 08:31 PM

I thought about that method as well. There is a problem with that method, however... If there are many people in the channel, you're going to be flooded off the server. smile

I'm trying to remember if you can do something like "/msg nick1,nick2,nick3 Hello" and have it only count as a single message with regards to server flood... I can't even remember right now if you can use commas like that and can't test /msg at work. It would probably end up needing to use a delay between messages.
Posted By: SladeKraven

Re: Message To All - 07/11/05 08:39 PM

That would be more sufficient using $addtok() however if the variable is too long it wont send to any users at all.

You could probably do .timer 1 $calc(%x + 1) $1 ...

-Andy
Posted By: Riamus2

Re: Message To All - 07/11/05 09:03 PM

Good point. I forgot about the line length. That could be split to about 50 or so nicks per line and then create a new line, of course.

Timers would work. I was thinking along the same lines, but using /play. Either way, 1 second delay will make a message get sent to the last nick in a 300 person channel 5 minutes after it was sent. laugh

Personally, I'd just message the channel if it's important to message everyone. That, or change the topic to whatever is needed.
Posted By: MikeChat

Re: Message To All - 07/11/05 11:08 PM

did just try $snicks and that worked
so all you need is a small alias to select all nicks
like this
Code:
alias nickall {
  %channel = $1
  var %all.nicks = $nick(%channel,0), %i = 1
  while (%i <= %all.nicks) {
    var %nic = $nick(%channel,%i)
    sline %channel %nic 
    inc %i
  }
  sline -r %channel $me
}
Posted By: SladeKraven

Re: Message To All - 07/11/05 11:12 PM

I forgot about $snicks. blush

-Andy
Posted By: DaveC

Re: Message To All - 07/11/05 11:13 PM

Quote:
How do I send private message to all people in a channel ?


ok lets break it down, you want to send a private message to everyone in the channel, So thats a message everyone in the channel can see....

Would not the simply solution be

/MSG #channel your message here

thats going to be private to everyone in the channel!
Posted By: MikeChat

Re: Message To All - 07/11/05 11:20 PM

Dave, I am sorry, that is to easy :P
haha
Posted By: NaquadaServ

Re: Message To All - 08/11/05 01:33 AM

Here some code that uses hash tables and timers, sends one msg per second, sorry for any bugs, I haven't tested it...
Code:
; /msgall #Channel Message
msgall {
  var %hash msgall. $+ $1 | var %x $nick($active,0)
  if (!$hget(%hash))
  while (%x) && ($2) {
    hadd %hash $nick($1,%x) $2-
    dec %x
  }
  .timerPush $+ $1 0 1 scid $cid pushmsgs %hash
}
pushmsgs {
  var %hash $1 | var %nick 
  set %nick $hget(%hash, 1).item
  .msg %nick $hget(%hash, %nick)
  hdel %hash %nick
  if ($hget(%hash, 0).item == 0) {
    .timer $+ $ctimer off
    hfree %hash
  }
}
Posted By: DaveC

Re: Message To All - 08/11/05 05:26 PM

Quote:
if (!$hget(%hash))


Is this ment to be.....
if (!$hget(%hash)) { hmake %hash }

I didnt like how it would result in an seemingly random order of nicks that were sent the message, and the loss of messages if a second /msgall command was issued before the timer had completed the previous one. I think /PLAY might be a better option.

[code];
;Usage : /msgall <channel> <message>
;
;Purpose : sends a private message of <message> to all users in channel <channel>, to avoid flooding 1 message per second is sent.
;
;Notes : WARNING <message> is evaluated at time of message delivery, like a timer.
; ie: In following example channel name is #CHANNEL, and AUSER is the 13th user in the channel
; cmd : //msgall #CHANNEL Time when run $time & time when sent $!time and time identifer $!!time
; msg : msg AUSER Time when run 12:00:00 & time when sent 12:00:13 and time identifer $time
;
alias msgall {
if (($0 > 1) && ($me ison $1)) {
var %file = $+(tempfile.,$ticks,.,$mid($rand(1000000,1999999),2),.txt), %m = $nick($1,0), %i = 1
write -c %file
while (%i <= %m) { write %file msg $nick($1,%i) $2- | inc %i }
.play -sc %file | .remove %file
}
}[code]
Posted By: NaquadaServ

Re: Message To All - 11/11/05 06:29 PM

Good eye, yup.
Posted By: NaquadaServ

Re: Message To All - 18/11/05 03:39 AM

Why would random be a problem? You are messaging everyone right? Why does A have to come before Z in this case?
© 2019 mIRC Discussion Forums