egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Script That Voices Lowercase Nicks

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
achilles1900
Voice


Joined: 21 Apr 2008
Posts: 30

PostPosted: Thu Feb 04, 2010 9:22 am    Post subject: Script That Voices Lowercase Nicks Reply with quote

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
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Thu Feb 04, 2010 6:08 pm    Post subject: Reply with quote

Am really bad at using the forum Search, but there is alot of these voice scripts requested before. Here's a quick one -->
Code:
 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
 ##

_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Feb 04, 2010 6:24 pm    Post subject: Reply with quote

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:
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
##

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
achilles1900
Voice


Joined: 21 Apr 2008
Posts: 30

PostPosted: Sat Feb 06, 2010 9:03 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
achilles1900
Voice


Joined: 21 Apr 2008
Posts: 30

PostPosted: Mon Sep 27, 2010 12:02 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Sep 27, 2010 1:13 pm    Post subject: Reply with quote

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:

[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. Laughing )
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Mon Sep 27, 2010 9:12 pm    Post subject: Reply with quote

Code:
 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:
nickname   => will be voiced
nickNAME   => will be voiced
NICKNAME   => will not be voiced

_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
achilles1900
Voice


Joined: 21 Apr 2008
Posts: 30

PostPosted: Tue Sep 28, 2010 9:00 am    Post subject: Reply with quote

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 Very Happy but it voiced LetMe, it shouldnt have done that as his nick starts with a capital letter Sad
P.S.
After watching it for awhile, it is voicing some but not all nicks starting with caps

what think? thanks, gratefully,
Achilles
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Tue Sep 28, 2010 9:19 pm    Post subject: Reply with quote

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:
$ tclsh8.5
% regexp -- {^[A-Z]} "nickname"
0
% regexp -- {^[A-Z]} "Nickname"
1
so use
Code:
    if {($U < $T)&&(![regexp -- {^[A-Z]} "$nick"])} {
and not
Code:
    if {$U < $T} {

_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
achilles1900
Voice


Joined: 21 Apr 2008
Posts: 30

PostPosted: Fri Oct 01, 2010 3:49 am    Post subject: Reply with quote

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 Very Happy

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
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Fri Oct 01, 2010 8:11 am    Post subject: Reply with quote

Code:
 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
    }
   }
  }
 }
Smile
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
achilles1900
Voice


Joined: 21 Apr 2008
Posts: 30

PostPosted: Sun Oct 03, 2010 7:21 am    Post subject: Reply with quote

Hey TCL_no_TK,

thanks for the update Very Happy 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
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Oct 03, 2010 3:24 pm    Post subject: Reply with quote

Yeah, I was missing out the ^ in this part
Code:
    # get rid of special characters in the nickname
    regsub -all -- "(\\\\|\\\[|\\\]|\\\}|\\\{|_|-|`|\\\|)" "$nick" "" target
using
Code:
    # get rid of special characters in the nickname
    regsub -all -- "(\\\\|\\\[|\\\]|\\\}|\\\{|\\\^|_|-|`|\\\|)" "$nick" "" target
will fix that.
Quote:
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:
... ![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"])
this will make sure the ^ char is not in the nickname.
Since
Code:
    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
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
achilles1900
Voice


Joined: 21 Apr 2008
Posts: 30

PostPosted: Sun Oct 17, 2010 10:28 am    Post subject: Reply with quote

Hi TCL_no_TK,

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

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 Very Happy
roland^ - should have voiced, did not Confused

I took out the |_|-| cause it was ignoring nicks like john_ or jimmy_jim

Quote:

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
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Oct 17, 2010 1:50 pm    Post subject: Reply with quote

Add to the
Code:
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:
$ 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
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber