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.

Script That Voices Lowercase Nicks

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Script That Voices Lowercase Nicks

Post by achilles1900 »

Hi Guys,

I need a script that would voice lowercase nicks eg. alice or dinobot.

I cant do tcl so i am afraid i cant modify any of the voice scripts. Would really appreciate your help.

I forgot to mention, the bot is in a few channels, would it also be possible to set which channel the script will run in?

thanks in advance,

Achilles
Last edited by achilles1900 on Mon Sep 27, 2010 11:57 am, edited 2 times in total.
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Am really bad at using the forum Search, but there is alot of these voice scripts requested before. Here's a quick one -->

Code: Select all

 setudef flag voice-lower

 proc voicelower:join {nick host hand chan} {
  if {[channel get "$chan" "voice-lower"]} {
   if {(![isbotnick "$nick"])&&(![regexp -- {[A-Z]} "$nick"])} {
    pushmode $chan +v $nick
   }
  }
 }

 bind join -|- "*%*" voicelower:join

 ##
 # Use: .chanset <#channel> +voice-lower     To Enable
 # Use: .chanset <#channel> -voice-lower     TO Disable
 ##
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

What if the nickname does not contain any alphabets? Here's a modified version of TCL_no_TK's code that handles those as well.

Code: Select all

setudef flag voice-lower

proc voicelower:join {nick host hand chan} {
 if {[channel get $chan voice-lower]} {
  if {![isbotnick $nick] && [string equal $nick [string tolower $nick]]} {
   pushmode $chan +v $nick
  }
 }
}

bind join - * voicelower:join

##
# Use: .chanset <#channel> +voice-lower     To Enable
# Use: .chanset <#channel> -voice-lower     TO Disable
##
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hi,

I want to thank TCL_no_TK & Sir_Fz for taking the time and effort to help. I really appreciate the great work you guys are doing for the TCL/eggdrop community and the newbs like me who dont know scripting.

Like to let you guys know that your efforts are helping out a lot of appreciative people.

I tested the script on my eggy for a few days and it works well. I used Sir_Fz edit to handle the non-alphabets.

thanks again and peace out

Achilles
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hi TCL Community,

i just discovered that while the script works great at voicing lower-case nicks, it does not, however, voice people who have capital letters in their lower case nicks

for example : johnUSA or jill187{USA} does not get voiced

any chance you can take a look and see whats missing? Really appreciate it.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

achilles1900 wrote:Hi TCL Community,

..., it does not, however, voice people who have capital letters in their lower case nicks
...
Right.
From the way I understand the script, this part:

Code: Select all

[string equal $nick [string tolower $nick]
does exactly that. Meaning: that if the nick is not all lower case, then it will not be voiced.

Is it that you'd like *everybody* to be voiced, regardless if they have nicks already all in lower case, and also nicks with mixed case?

Perhaps you could re-state just what it is that you'd like to accomplish....
( or maybe I'm just confused. :lol: )
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Code: Select all

 proc voicelower:join {nick host hand chan} {
  if {[channel get "$chan" "voice-lower"]} {
   if {![isbotnick "$nick"]} {
    set T [string bytelength $nick]
    set U [regexp -all {[A-Z]} $nick]
    if {$U < $T} {
     pushmode $chan +v $nick
    }
   }
  }
 }
:arrow: As long as the nickname dosen't have all caps in it, the proc above will voice them.

Code: Select all

nickname   => will be voiced
nickNAME   => will be voiced
NICKNAME   => will not be voiced
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hi TCL_no_TK,

thnks for the quick reply man, i just loaded the script up, thus far working OK.

However, just now i noticed this :

* Joins: mwf43 (~pirch@c-68-33-142-24.hsd1.md.comcast.net)
* BOT sets mode: +v mwf43
* Joins: LetMe (~fullon@c122-108-58-95.sunsh1.vic.optusnet.com.au)
* BOT sets mode: +v LetMe
* Parts: LetMe (~fullon@c122-108-58-95.sunsh1.vic.optusnet.com.au)


It voices mwf43 like it is supposed to :D but it voiced LetMe, it shouldnt have done that as his nick starts with a capital letter :(
P.S.
After watching it for awhile, it is voicing some but not all nicks starting with caps

what think? thanks, gratefully,
Achilles
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

I had to say I didn't have chance to look over it much, maybe add a little rule to stop nickname's starting with a capital letter from being voiced?

Code: Select all

$ tclsh8.5
% regexp -- {^[A-Z]} "nickname"
0
% regexp -- {^[A-Z]} "Nickname"
1
so use

Code: Select all

    if {($U < $T)&&(![regexp -- {^[A-Z]} "$nick"])} { 
and not

Code: Select all

    if {$U < $T} { 
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hi TCL_no_TK,

thanks for the quick reply and help. Plugged it into the bot and its working like a charm. All the nicks it didn't voice before it does now :D

Just one observation tho, check it out :

``GaBuck_I (~gabucki@host.net) joined #Channel
#Channel: mode change '+v ``GaBuck_I' by BOT

That was the only nick it voiced that it wasn't supposed to. I am thinking the "``" in his nick threw the bot there.
But its no big deal at all, i can live with that, i am extremely pleased how well its doing, just thought id report that back for your information and for others who are also using this script.

thanks again and best regards,
Achilles who is slowly learning TCL
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Code: Select all

 proc voicelower:join {nick host hand chan} {
  if {[channel get "$chan" "voice-lower"]} {
   if {![isbotnick "$nick"]} {
    # get rid of special characters in the nickname
    regsub -all -- "(\\\\|\\\[|\\\]|\\\}|\\\{|_|-|`|\\\|)" "$nick" "" target
    set T [string bytelength $target]
    set U [regexp -all {[A-Z]} $target]
    # dont voice if the first char in the nickname is a CAPITAL letter
    if {($U < $T)&&(![regexp -- {^[A-Z]} "$target"])} { 
     pushmode $chan +v $target
    }
   }
  }
 }
:)
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hey TCL_no_TK,

thanks for the update :D Tested it out last night, here's what I found:

Doesn't voice nicks like the following :
_carol
coffee_addict
mike``
anna_
polite_miss


Voiced this nick:
^Roland^

Is there a way where i can add special characters to ignore? I see that string there in your script, was wondering how could i modify it.

Thanks a lot again TCL, hope this feedback works.

Achilles
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Yeah, I was missing out the ^ in this part

Code: Select all

    # get rid of special characters in the nickname
    regsub -all -- "(\\\\|\\\[|\\\]|\\\}|\\\{|_|-|`|\\\|)" "$nick" "" target 
using

Code: Select all

    # get rid of special characters in the nickname
    regsub -all -- "(\\\\|\\\[|\\\]|\\\}|\\\{|\\\^|_|-|`|\\\|)" "$nick" "" target 
will fix that.
Is there a way where i can add special characters to ignore? I see that string there in your script, was wondering how could i modify it.
You can use regexp its pretty much the same with my usage of regsub. I've used

Code: Select all

... ![regexp -- {^[A-Z]} "$target"])} {
to stop it from voicing people that have nickname that starts with a capital letter. And if you wanted to make sure it didn't voice anyone with a char in the nickname for example the ^ char again. you could add

Code: Select all

(![regexp -- {\^} "$target"])
this will make sure the ^ char is not in the nickname.
Since

Code: Select all

    regsub -all -- "(\\\\|\\\[|\\\]|\\\}|\\\{|_|-|`|\\\|)" "$nick" "" target 
removes the chars from the nickname. I'd comment it out, before adding more to the if statement, so you can test what chars you want to allow and disallow from being voiced.

post on regexp
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hi TCL_no_TK,

sorry for the late reply, was out of town. This is your code i am using :-

Code: Select all

setudef flag voice-lower

 proc voicelower:join {nick host hand chan} {
  if {[channel get "$chan" "voice-lower"]} {
   if {![isbotnick "$nick"]} {
    # get rid of special characters in the nickname
    regsub -all -- "(\\\\|\\\[|\\\]|\\\}|\\\{|\\\^|``|\\\|)" "$nick" "" target  
    set T [string bytelength $target]
    set U [regexp -all {[A-Z]} $target]
    # dont voice if the first char in the nickname is a CAPITAL letter
    if {($U < $T)&&(![regexp -- {^[A-Z]} "$target"])} {
     pushmode $chan +v $target
    }
   }
  }
 }

bind join - * voicelower:join

##
# Use: .chanset <#channel> +voice-lower     To Enable
# Use: .chanset <#channel> -voice-lower     TO Disable
This is what i found :

^Roland^ - did not voice - good :D
roland^ - should have voiced, did not :?

I took out the |_|-| cause it was ignoring nicks like john_ or jimmy_jim
You can use regexp its pretty much the same with my usage of regsub. I've used
Code:
... ![regexp -- {^[A-Z]} "$target"])} {
to stop it from voicing people that have nickname that starts with a capital letter. And if you wanted to make sure it didn't voice anyone with a char in the nickname for example the ^ char again. you could add
Code:
(![regexp -- {\^} "$target"]
I dont understand this part, where do i insert the nickname characters in the code? ![regexp -- {^[A-Z]} {\^} "$target"])} { Like that?

thanks again for the help
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

Add to the

Code: Select all

if {($U < $T)&&(![regexp -- {^[A-Z]} "$target"])} { 
In the if statement above.

If you have access to tclsh on youre shell, its worth just playing around with it a bit and see what matches and what dosen't. You can simply just use the basic

Code: Select all

$ tclsh8.5
% set nick "nickname-with-<char to match>"
% regexp -- {<char to match>} "$nick"
will return 1 if it matches or 0 if it dosen't
Post Reply