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 

Special voicing script help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
indigo`
Voice


Joined: 30 Dec 2005
Posts: 5

PostPosted: Fri Dec 30, 2005 9:28 pm    Post subject: Special voicing script help Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Dec 30, 2005 9:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
indigo`
Voice


Joined: 30 Dec 2005
Posts: 5

PostPosted: Fri Dec 30, 2005 9:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Dec 31, 2005 12:04 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Dec 31, 2005 5:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Dec 31, 2005 9:04 am    Post subject: Reply with quote

'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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Dec 31, 2005 9:36 am    Post subject: Reply with quote

Agh! my bad, duno why I had the wrong impression he posted something else. Embarassed I'd better take a nap. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Dec 31, 2005 10:27 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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