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.

Number of bans

Old posts that have not been replied to for several years.
g
gemeau50
Voice
Posts: 38
Joined: Fri Jun 11, 2004 6:16 am
Location: Trois-Rivières, Canada

Number of bans

Post by gemeau50 »

Is there a command other than ".bans all" to get the number of bans in an eggdrop banlist?

TIA
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

no
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Re: Number of bans

Post by YooHoo »

gemeau50 wrote:Is there a command other than ".bans all" to get the number of bans in an eggdrop banlist?

TIA
Next time, you can skip the thread, and just read egghelp's command reference, or figure out how to use .help :mrgreen:
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

i think this .. works

Code: Select all

bind dcc - nban number_bans
proc number_bans {hand idx arg} {
  putdcc $idx "[llength [banlist]]"
}
not tested tho ..
XplaiN but think of me as stupid
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

that would only return global bans, not channel bans, and you should use 'string length [join banlist]' or it would just return 1 ban
Last edited by greenbear on Sun Oct 24, 2004 2:01 pm, edited 1 time in total.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

then make it banlist $chan i gues ..

Code: Select all

bind dcc - nban number_bans
proc number_bans {hand idx arg} {
  putdcc $idx "[llength [banlist [string map {\\ \\\\ \[ \\\[ \] \\\] \( \\\( \) \\\) \{ \\\{ \} \\\} \" \\\"} [lindex $arg 0]]]]"
}
XplaiN but think of me as stupid
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

gb wrote:that would only return global bans, not channel bans, and you should use 'string length [join banlist]' or it would just return 1 ban
never use string llength and never had any problems so far ..
also i think u should read closer ..

Treats list as a list and returns a decimal string giving the number of elements in it.

every ban is a new arg so .. it would return the number if ur talking bytelength yes then ur right but if that where the case then it wouldn't it return the right number either ..
% llength "a b c d e f g"
7
%
XplaiN but think of me as stupid
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

hmm it appears i am in the wrong forum i tought this was the tcl scripting forum .. lol sorry
XplaiN but think of me as stupid
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

hehe yea nm that .. i was testing on a bot with no bans set, so i goofed up.

You could also use a foreach

Code: Select all

bind dcc - nban number_bans
proc number_bans {hand idx arg} { 
 set bans [llength [banlist]]
 foreach chan [channels] {
  incr bans [llength [banlist $chan]]
 }
 putidx $idx "Number of bans: $bans"
}
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

well yeah but that would not return it for a specific channel and also a loop is a thing that is slower then just llength ... ;) but sur ur right u could also do that .. if u want it for all channels at once ..

altho i am not sur about incr, but could be tho never used it like that tho ..

Code: Select all

incr bans [llength [banlist $chan]]
i am asuming ur dong it because u think .. u need to cause of 0 1 ..

thing is llength doesn't do that it returns the number of chars starting count with 1 not with 0
XplaiN but think of me as stupid
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

incr works just fine, llength returns the exact number of hits, so you get 0 if theres' no bans, incr dont have any problems increasing 0. and why wouldn't i use incr when i want to increase a number ?
g
gemeau50
Voice
Posts: 38
Joined: Fri Jun 11, 2004 6:16 am
Location: Trois-Rivières, Canada

Re: Number of bans

Post by gemeau50 »

YooHoo wrote:Next time, you can skip the thread, and just read egghelp's command reference, or figure out how to use .help :mrgreen:
I didn't ask how to get a listing of bans but how to get the number of bans. When there are more than 800 bans in the banlist, receiving a listing slows down a computer for a while dishing out a lot of information which are not required.

Next time you can skip my threads or figure out how to properly read a question. :mrgreen:
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

if that is the case maybe next time u can skip the forum right to the manual
XplaiN but think of me as stupid
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Re: Number of bans

Post by greenbear »

gemeau50 wrote:Next time you can skip my threads or figure out how to properly read a question. :mrgreen:
Don't you mean, "Thank you YooHoo, Ofloo and gb for taking the time to reply to my post" ?
g
gemeau50
Voice
Posts: 38
Joined: Fri Jun 11, 2004 6:16 am
Location: Trois-Rivières, Canada

Post by gemeau50 »

Ofloo wrote:if that is the case maybe next time u can skip the forum right to the manual
gb wrote:Don't you mean, "Thank you YooHoo, Ofloo and gb for taking the time to reply to my post" ?
Sorry gentlemen if I offended you. Here is my reason for such reply. gb reply was short and sweet. I did mentioned "other than .bans all". I was looking for an hidden command or switch. When you have more than 800 bans in the eggdrop banlist, ".bans all" can tie up your computer for a while. 3 hours later Yoohoo replied by referencing the "bans" command and that I should figure out how the use "help". I found his reply useless and out of line.

As for the help I received from you guys, believe me, it was really appreciated.
gemeau50
Locked