mIRC Homepage

echo nicknames in a channel

Posted By: Buggs2008

echo nicknames in a channel - 03/08/08 12:06 AM

Hello,

I would like to echo all nicknames in a channel, how would I go about doing this.

Thanks

J
Posted By: OrionsBelt

Re: echo nicknames in a channel - 03/08/08 01:06 AM

Code:
alias echo-nicks {
  var %cnt = 1
  var %ttl = $nick($chan,0)
  while (%cnt <= %ttl) {
    echo -a $nick($chan,%cnt)
    inc %cnt
  }
}


enjoy!
Posted By: RusselB

Re: echo nicknames in a channel - 03/08/08 01:35 AM

This is one case where I would recommend not using a variable for the end, but force mIRC to look up the total each time, so that any joins or parts that happen while the script is running are taken into account for. This will slow down the script a little bit, but the difference is so small, I'm unsure if it would even come to be 1 millisecond on anything less than a huge room (ie: 100 names or more).
Posted By: hixxy

Re: echo nicknames in a channel - 03/08/08 01:44 AM

Seeing as the script will only take milliseconds to run it's not likely that the nick will join while it's running anyway.
Posted By: argv0

Re: echo nicknames in a channel - 03/08/08 01:46 AM

Did you guys both forget mIRC is single threaded? $nick(#,0) will be the same value until that loop (and script) finishes.
Posted By: hixxy

Re: echo nicknames in a channel - 03/08/08 01:20 PM

That too grin
Posted By: Buggs2008

Re: echo nicknames in a channel - 03/08/08 03:06 PM

Great work,

Thanks to everyone.

I have one more quick question, now instead of displaying them in a seperate line ex

Nickname1
Nickname2
Nickname3

is there a way to echo them on one line ex.

Nickname1, Nickname2, Nickname3

Thanks a bunch.

Cheers,

J
Posted By: Wims

Re: echo nicknames in a channel - 03/08/08 03:15 PM

Code:
alias echo-nicks {
var %a = $nick($active,0) 
while (%a) var %n = %n $nick($active,%a) ,%a = %a - 1
echo -a %n
}
Will not work if the lenght of %n is more than the limit in mirc (now ~4100)
Posted By: Buggs2008

Re: echo nicknames in a channel - 03/08/08 04:54 PM

Thanks Wims!

Works great.

I am just wondering where I could put this line into the alias as well to get the pnick I tried to do it, but Im not getting anywhere fast without the help of you guys.

Code:
  var %p = $left($nick($chan,$nick).pnick,1) | if (%p == $left($nick,1)) { unset %p }
 


Code:
alias echo-nicks {
var %a = $nick($active,0) 
while (%a) var %n = %n $nick($active,%a) ,%a = %a - 1
echo -a %n
}
 
Posted By: Lpfix5

Re: echo nicknames in a channel - 03/08/08 04:55 PM

Will do all the good stuff for you and not worry about length issue's has it will break it down if length exceeds. Pnick values already present.

Code:
alias echo-nicks { names $active | %xd = 1 }
raw 353:*:{ if %xd == 1 { echo -a $sorttok($4-,32) | %xd = 0 } }
Posted By: Wims

Re: echo nicknames in a channel - 03/08/08 07:10 PM

Yes it does, but this method involve that the OP have to manage (he if has something) his other raw to halt the defaut text and you can't use it as a custom $ident for example.Also, if the raw 353 is called more than one time, %xd will be unset, it should be unset when the /names is finished and /haltdef may be use if %xd exists in all raw related to /names
Posted By: Lpfix5

Re: echo nicknames in a channel - 05/08/08 05:47 PM

the overlapping part is easy fix

Code:
alias echo-nicks { names $active | set -u3 %xd 1 }
raw 353:*:{ if %xd == 1 { echo -a $sorttok($4-,32) } } 
© 2020 mIRC Discussion Forums