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.

Wracking my little brain...

Old posts that have not been replied to for several years.
Locked
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Wracking my little brain...

Post by Alchera »

Hi,

My problem (with TCL of course) is probaby so simple to solve but, in my current brain dead state it's beyond me; and after hours of searching and experimenting.

I have written a nifty little script that bans all users entering a channel with numerical idents (~stw52890@ for example), instead of doing the conventional ban I just want to ban the last digit ie. *!*0@* no matter what that digit is. Can any one help one brain dead user? :)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Well one method is you can just use .+ban *!*#@* 10 times, where # is 0 to 9 of course....

Via Tcl however...

Assuming you have a userhost in say variable $uhost of the form <ident>@<host> ...

Code: Select all

set ident [lindex [split $uhost @] 0]
# replace with newchanban or whatnot...
putserv "MODE #chan +b *!*[string range $ident end end]@*"
# 'end end' may be invalid arguments depending on your Tcl Version,
# so you may need to use:
# *!*[string index $ident [expr {[string length $ident] - 1}]]@*
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

or use [string index $ident end] :)
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Again, depending on your Tcl version, 'end' may be an invalid argument for string index, yielding the error:
expected integer but got "end"
To ensure compatibility, see the commented code in my previous post.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Hi,

Many thanks for the help. There is much good karma coming in your direction. :)

No problems with 'end', I'm using the right version TCL. :mrgreen:
Well one method is you can just use .+ban *!*#@* 10 times, where # is 0 to 9 of course....
Ummm... I did have that which is why I wrote the script. LOL :oops:
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Locked