This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Making the bot return all users

Old posts that have not been replied to for several years.
Locked
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Making the bot return all users

Post by metroid »

I've been going at this for awhile but i can't seem to figure to figure out how to do it

What i came up with

Code: Select all

foreach channel [channels] { set user [llength [chanlist $channel]] }
This would return all the users for the channels, but i can't seem to figure out how to make the bot add it all up to one number, for example 203
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set count 0
foreach channel [channels] {
  incr count [llength [chanlist $channel]]
}
# then use $count
Once the game is over, the king and the pawn go back in the same box.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Thanks figured it out, now the next problem i'm having is this


Code: Select all

	set users 0 ; foreach channel [channels] { foreach nick [chanlist $channel] { if {[nick2hand $nick] != "*"} { incr users } } }
	putquick "NOTICE $nickname :Currently AUTH'ed Users: $users"
This code counts every person that's authed at that moment but the problem is that it also counts the same handle again and i have no clue how to take that out :(
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

set ul {}
foreach c [channels] {
  foreach n [chanlist $c] {
    if {[nick2hand $n $c] != "*" && [lsearch -exact $ul $n] == -1} {
      lappend ul $n
    }
  }
}
puthelp "notice $nick :auth'ed users: [llength $ul]"
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Should you escape the * thing like "\*" ?
Once the game is over, the king and the pawn go back in the same box.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you mean enclosing it in double quotes? yes, it's necessary... otherwise you get syntax error "unexpected operator *"
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Actualy it should be "shouldnt" not "should" .. damn typo :D Yah, something like that..
Once the game is over, the king and the pawn go back in the same box.
Locked