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.

Simple TCL Script

Old posts that have not been replied to for several years.
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Simple TCL Script

Post by kevie »

Hi, i would like to know how could i get a simple tcl script which enables the eggdrop to voice the user when he say certain line in the channel?
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

Use a pubm bind

Code: Select all

set line "line to say"
bind pubm - "*$line*" voiceUser
proc voiceUser {nick uhost hand channel rest} {
putserv "MODE $channel +v :$nick"
}
It is a mistake to think you can solve any major problems just with potatoes.
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Post by kevie »

How do i add a reply to the user who was voiced?
Something like this? :
#puthelp "PRIVMSG $nick :you have been voiced in $chan"
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

yup (if you remove that # off course :wink:)
Oh, and the channel parameter in my proc is $channel and not $chan ...
It is a mistake to think you can solve any major problems just with potatoes.
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Post by kevie »

Thanks so much. Just wonder how could i add a timer to it? like if the voiced user did not say the "something" within 30mins, it will devoice them.
User avatar
ReaLz
Op
Posts: 121
Joined: Sat Oct 19, 2002 5:33 am
Location: Athens, Greece

Post by ReaLz »

heh..... check this:

Code: Select all

## Settings
set line "line to say"
set phrase "phrase to say not to be devoiced"
set channel "#channel"

## Binds
bind pubm - "*$line*" voiceUser
bind time - "00 * * * *" time_proc
bind time - "30 * * * *" time_proc
bind pubm - "*$phrase" saveUser

## Code
proc voiceUser {nick uhost hand channel rest} { 
putserv "MODE $channel +v :$nick"
puthelp "NOTICE $nick :You've just been voiced, remember to say $phrase in 30 minutes to avoid getting devoiced"
return
}

proc time_proc {min hour day month year} {check_word} 

proc check_word {} {
if {![botisop $::channel]} {
putlog "I'm not oped in $::channel."
}
foreach user [chanlist $::channel] {
if {[isvoice $user $::channel]} {
set hand [nick2hand $user]
if {[matchattr $hand S]} {
return
}
pushmode $::channel -v $user
}
}
}

proc saveUser {nick chan hand idx args} {
if {[validuser $hand]} {
chattr $hand +S
return
}
adduser $nick
chattr $nick +S
}
«A fantastic spaghetti is a spaghetti that does not exist»
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Post by kevie »

ReaLz, I have no prob with those lines concerning the voicing of users saying the line, but the bot wun devoice them when they didnt repeat that line for more than 30 minutes. :o
User avatar
ReaLz
Op
Posts: 121
Joined: Sat Oct 19, 2002 5:33 am
Location: Athens, Greece

Post by ReaLz »

uhm yes you're right...

change the time_proc with this:

proc time_proc {min hour day month year} {check_word}

proc check_word {} {
if {![botisop $::channel]} {
putlog "I'm not oped in $::channel."
}
foreach user [chanlist $::channel] {
if {[isvoice $user $::channel]} {
set hand [nick2hand $user]
if {[matchattr $hand S]} {
chattr $hand -S
return
}
pushmode $::channel -v $user
}
}
}
«A fantastic spaghetti is a spaghetti that does not exist»
User avatar
ReaLz
Op
Posts: 121
Joined: Sat Oct 19, 2002 5:33 am
Location: Athens, Greece

Post by ReaLz »

uhm yes you're right...

change the time_proc with this:

Code: Select all

proc time_proc {min hour day month year} {check_word} 

proc check_word {} { 
if {![botisop $::channel]} { 
putlog "I'm not oped in $::channel." 
} 
foreach user [chanlist $::channel] { 
if {[isvoice $user $::channel]} { 
set hand [nick2hand $user] 
if {[matchattr $hand S]} {
chattr $hand -S
return 
}
pushmode $::channel -v $user 
} 
} 
} 
«A fantastic spaghetti is a spaghetti that does not exist»
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Please avoid repeating/posting the same topic. :P
Once the game is over, the king and the pawn go back in the same box.
User avatar
ReaLz
Op
Posts: 121
Joined: Sat Oct 19, 2002 5:33 am
Location: Athens, Greece

Post by ReaLz »

oops.. I clicked the Back button :P
«A fantastic spaghetti is a spaghetti that does not exist»
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

btw, after the:
putlog "I'm not oped in $::channel."
you should add a return cos as far as I can see it continues the proc after the putlog.
Once the game is over, the king and the pawn go back in the same box.
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Post by kevie »

It works now! Bravo. Anyway, can i put a puthelp "NOTICE $nick :you've been devoiced..." on it after the bot devoiced the user?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Give it a try. I'm shure it won't bite you. :)
Once the game is over, the king and the pawn go back in the same box.
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Post by kevie »

seems like i ended up with more errors,
Tcl error [time_proc]: can't read "nick": no such variable
Can anyone help me out with that?
Locked