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.

Userlist script with total counter

Old posts that have not been replied to for several years.
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Userlist script with total counter

Post by Winters »

Hi @ all!

I just tryed to make a userlist script with a total counter like this:

[User1: +mno] [User2: +k] [User3: +v]
Total 3 (Owner: 1, Master: 1, Operator: 1, Voice: 1, Ban: 1)

Could you please add it in this script? thx :>

Code: Select all

  if {![info exists total]} {
    set total "0"
  }
  set userlist []
  foreach i [userlist |aomnv $chan] {
    if {$total >= "5"} {
      putserv "notice $nick :Userlist of $chan:"
      putserv "NOTICE $nick :$userlist"
      set userlist []
      set total "0"
    }
    lappend userlist "User: $i    Flags: \[[lindex [split [chattr $i $chan] |] 1]\]"
    incr total
  }
  if {$total != "0"} {
    putserv "notice $nick :Userlist of $chan:"
    putserv "NOTICE $nick :$userlist"
  }
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pub - !listusers list:users

proc list:users {nick uhost hand chan arg} {
 set total(owners) 0
 set total(masters) 0
 set total(operaters) 0
 set total(voices) 0
 set total(total) 0
 foreach user [userlist] {
  incr total(total)
  if {[matchattr $user |n $chan]} {
   lappend users(owners) $user
   incr total(owners)
  } elseif {[matchattr $user |m $chan]} {
   lapped users(masters) $user
   incr total(masters)
  } elseif {[matchattr $user |o $chan]} {
   lappend users(operaters) $user
   incr total(operaters)
  } elseif {[matchattr $user |v $chan]} {
   lappend users(voices) $user
   incr total(voices)
  }
 }
 foreach an [array names users] {
  puthelp "NOTICE $nick :$an: [join $users($an)]"
 }
 foreach ann [array names total] {
  lappend tout "\[$ann: $total($ann)\]"
 }
 puthelp "NOTICE $nick :[join $tout]"
}
not tested.
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

Thx it works but could you make it so pls:

User1 +flags, User2 +flags, User3 +flags, User4 +flags, User5 +flags -nextline
User 6 etc etc
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try

Code: Select all

bind pub - !listusers list:users 

proc list:users {nick uhost hand chan arg} { 
 set total(owners) 0 
 set total(masters) 0 
 set total(operaters) 0 
 set total(voices) 0 
 set total(total) 0 
 foreach user [userlist] { 
  incr total(total) 
  if {[matchattr $user |n $chan]} { 
   lappend users "$user +n," 
   incr total(owners) 
  } elseif {[matchattr $user |m $chan]} { 
   lapped users "$user +m,"
   incr total(masters) 
  } elseif {[matchattr $user |o $chan]} { 
   lappend users "$user +o,"
   incr total(operaters) 
  } elseif {[matchattr $user |v $chan]} { 
   lappend users "$user +v,"
   incr total(voices) 
  } 
 }
 if {[llength $users]} {
  puthelp "NOTICE $nick :[string trimright [join $users] ,]"  
 }
 foreach ann [array names total] { 
  lappend tout "\[$ann: $total($ann)\]" 
 } 
 puthelp "NOTICE $nick :[join $tout]" 
}
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

Thx Sir_Fz it's perfect now ;)

Edit: Hm it worked now i get this error

wrong # args: should be "userlist nick uhost hand chan arg"
while executing
userlist
(procedure "list:users" line 7)
invoked from within
list:users $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

That error doesn't make much sense, Are you sure you didn't try to edit it yourself?
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

Yes im sure.

I loaded the script.. at first it worked than after 2 mins the bot didn't reply anything
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I guess you have a proc called "userlist" which is overloading on the [userlist] eggdrop tcl command.
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

yeah there was a proc with userlist sry :<
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

kk now i fixed it and i just want that the bot send 5 users per line could you make it please :>?

Code: Select all

bind pub - !listusers list:users

proc list:users {nick uhost hand chan arg} {
putserv "notice $nick :Users for channel $chan:"
 set total(owner) 0
 set total(master) 0
 set total(operator) 0
 set total(voice) 0
 set total(ban) 0
 set total(Total) 0
 foreach user [userlist] {
  incr total(Total)
  if {[matchattr $user |n $chan]} {
   lappend users "\{\User: $user Flags: +n\}\ "
   incr total(owner)
  } elseif {[matchattr $user |m $chan]} {
   lappend users "\{\User: $user Flags: +m\}\ ,"
   incr total(master)
  } elseif {[matchattr $user |o $chan]} {
   lappend users "\{\User: $user Flags: +o\}\ ,"
   incr total(operator)
  } elseif {[matchattr $user |v $chan]} {
   lappend users "\{\User: $user Flags: +v\}\ ,"
   incr total(voice)
  } elseif {[matchattr $user |k $chan]} {
   lappend users "\{\User: $user Flags: +k\}\ ,"
   incr total(ban)
  }
 }
 if {[llength $users]} {
  putserv "NOTICE $nick :[string trimright [join $users] ,]" 
 }
foreach ann [array names total] {
putserv "notice $nick :Total: $total(Total) (owner: $total(owner), master: $total(master), op: $total(operator), voice: $total(voice), ban: $total(ban))."
}
}
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

change

Code: Select all

if {[llength $users]} { 
  putserv "NOTICE $nick :[string trimright [join $users] ,]" 
 } 

to

Code: Select all

if {([llenth $users] <= 5)} { 
  putserv "NOTICE $nick :[string trimright [join $users] ,]" 
 } 
I think that should work.
r0t3n @ #r0t3n @ Quakenet
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

nope doesn't work :/
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

try

Code: Select all

if {([llenth $users] <= 5)} { 
  putserv "NOTICE $nick :[string trimright [join $users] [join $users] [join $users] [join $users] [join $users] ,]" 
 }
Maybe that will work.
r0t3n @ #r0t3n @ Quakenet
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

doesn't work :(
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Tosser^^ wrote:try

Code: Select all

if {([llenth $users] <= 5)} { 
  putserv "NOTICE $nick :[string trimright [join $users] [join $users] [join $users] [join $users] [join $users] ,]" 
 }
Maybe that will work.
why don't you quit posting your clueless and useless stuff already? you don't know what you are doing, yet you feel obliged to advise others - that's preposterous

@Winters: instead of

Code: Select all

putserv "NOTICE $nick :[string trimright [join $users] ,]"
use:

Code: Select all

foreach {u1 u2 u3 u4 u5} $users {
   putserv "notice $nick :$u1, $u2, $u3, $u4, $u5"
}
Locked