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.

Special voicing script help

Help for those learning Tcl or writing their own scripts.
Post Reply
i
indigo`
Voice
Posts: 5
Joined: Fri Dec 30, 2005 8:56 pm

Special voicing script help

Post by indigo` »

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: Select all

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   
   }

}

User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You want the bot to voice lower-cased nicks when they change nick or rejoin from a split?
i
indigo`
Voice
Posts: 5
Joined: Fri Dec 30, 2005 8:56 pm

Post by indigo` »

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.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

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: Select all

 tag when posting logs, code
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

'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: Select all

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.
.tcl string is lower sir_fz
Tcl: 0
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Agh! my bad, duno why I had the wrong impression he posted something else. :oops: I'd better take a nap. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Another approach:

Code: Select all

bind join - * foo

proc foo {n u h c} {
 if {[string tolower $n] == $n} {
  pushmode $c +v $n
 }
}
Post Reply