| View previous topic :: View next topic |
| Author |
Message |
indigo` Voice
Joined: 30 Dec 2005 Posts: 5
|
Posted: Fri Dec 30, 2005 9:28 pm Post subject: Special voicing script help |
|
|
This code worked well in the past. Now it doesn't.
I need it to voice only those with lowercase nicks. What am I doing wrong?
Right now, it only voices them if they deop, but not when they enter or rejoin.
| Code: |
global alpha caps
set caps abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
set alpha ABCDEFGHIJKLMNOPQRSTUVWXYZ
bind nick - * nick_voice
bind mode - "#channel -o" mode_voice
bind rejn - * rejn_voice
proc nick_voice {nick hand host chan new} {
global alpha caps
set nfirst [string index $new 0]
set nsecond [string index $new 1]
if { [string first $nfirst $alpha] == -1 } {
set nfirst $nsecond
}
if { [string first $nfirst $caps] >= 0 } {
pushmode $chan +v $new
}
}
proc mode_voice {nick hand host chan mode victim} {
global alpha caps
set nfirst [string index $victim 0]
set nsecond [string index $victim 1]
if { [string first $nfirst $alpha] == -1 } {
set nfirst $nsecond
}
if { [string first $nfirst $caps] >= 0 } {
pushmode $chan +v $victim
}
}
proc rejn_voice {nick hand host chan} {
global alpha caps
set nfirst [string index $nick 0]
set nsecond [string index $nick 1]
if { [string first $nfirst $alpha] == -1 } {
set nfirst $nsecond
}
if { [string first $nfirst $caps] >= 0 } {
pushmode $chan +v $nick
}
}
|
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Dec 30, 2005 9:55 pm Post subject: |
|
|
You want the bot to voice lower-cased nicks when they change nick or rejoin from a split? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
indigo` Voice
Joined: 30 Dec 2005 Posts: 5
|
Posted: Fri Dec 30, 2005 9:58 pm Post subject: |
|
|
| I want the bot to voice lowercased nicks when they enter channel, whether they get opped or not, and whether it's their first time in channel or they've rejoined from a split. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Dec 31, 2005 12:04 am Post subject: |
|
|
| Code: |
bind join - * foo
proc foo {n u h c} {
foreach ch [split $n {}] {
if [string is upper $ch] return
}
pushmode $c +v $n
}
|
_________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Dec 31, 2005 5:42 am Post subject: |
|
|
Shouldn't 'return' be 'continue' by any chance? And the 'pushmode $c +v $n' shouldn't be placed in the foreach loop after 'if [string is upper $ch] return' (wich should be 'continue' not 'return')? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Dec 31, 2005 9:04 am Post subject: |
|
|
'continue' would be usless, since he doesn't want to continue if he found an upper-case letter in the nick. If you're wondering why he didn't use
| Code: | if {[string is lower $n]} {
pushmode $c +v $n
} |
that's because if there are numbers or characters like (^-_...etc) in the nick, [string is lower] will return 0.
| Quote: | .tcl string is lower sir_fz
Tcl: 0 |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Dec 31, 2005 9:36 am Post subject: |
|
|
Agh! my bad, duno why I had the wrong impression he posted something else. I'd better take a nap.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Dec 31, 2005 10:27 am Post subject: |
|
|
Another approach:
| Code: | bind join - * foo
proc foo {n u h c} {
if {[string tolower $n] == $n} {
pushmode $c +v $n
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|