mIRC Home    About    Download    Register    News    Help

Print Thread
echo nicknames in a channel #202931 03/08/08 12:06 AM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hello,

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

Thanks

J

Re: echo nicknames in a channel [Re: Buggs2008] #202932 03/08/08 01:06 AM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Code:
alias echo-nicks {
  var %cnt = 1
  var %ttl = $nick($chan,0)
  while (%cnt <= %ttl) {
    echo -a $nick($chan,%cnt)
    inc %cnt
  }
}


enjoy!

Re: echo nicknames in a channel [Re: OrionsBelt] #202933 03/08/08 01:35 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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).

Re: echo nicknames in a channel [Re: RusselB] #202934 03/08/08 01:44 AM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Seeing as the script will only take milliseconds to run it's not likely that the nick will join while it's running anyway.

Re: echo nicknames in a channel [Re: RusselB] #202935 03/08/08 01:46 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Did you guys both forget mIRC is single threaded? $nick(#,0) will be the same value until that loop (and script) finishes.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: echo nicknames in a channel [Re: argv0] #202950 03/08/08 01:20 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That too grin

Re: echo nicknames in a channel [Re: Buggs2008] #202952 03/08/08 03:06 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
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

Re: echo nicknames in a channel [Re: Buggs2008] #202953 03/08/08 03:15 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
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)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: echo nicknames in a channel [Re: Buggs2008] #202956 03/08/08 04:54 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
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
}
 

Last edited by Buggs2008; 03/08/08 04:55 PM.
Re: echo nicknames in a channel [Re: Wims] #202957 03/08/08 04:55 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
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 } }


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: echo nicknames in a channel [Re: Lpfix5] #202958 03/08/08 07:10 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
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


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: echo nicknames in a channel [Re: Wims] #203045 05/08/08 05:47 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
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) } } 


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }