mIRC Home    About    Download    Register    News    Help

Print Thread
#202931 03/08/08 12:06 AM
Joined: Oct 2007
Posts: 214
B
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

Joined: Apr 2006
Posts: 464
O
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!

Joined: Aug 2004
Posts: 7,252
R
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).

Joined: Sep 2005
Posts: 2,881
H
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.

Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That too grin

Joined: Oct 2007
Posts: 214
B
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

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2007
Posts: 214
B
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.
Joined: Aug 2005
Posts: 1,052
L
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* }
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2005
Posts: 1,052
L
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* }

Link Copied to Clipboard