View previous topic :: View next topic |
Author |
Message |
kevie Voice
Joined: 10 Jun 2003 Posts: 12
|
Posted: Tue Jun 10, 2003 3:49 am Post subject: Simple TCL Script |
|
|
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? |
|
Back to top |
|
 |
mortician Voice
Joined: 22 Sep 2002 Posts: 37 Location: Tsjakamaka
|
Posted: Tue Jun 10, 2003 3:58 am Post subject: |
|
|
Use a pubm bind
Code: |
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. |
|
Back to top |
|
 |
kevie Voice
Joined: 10 Jun 2003 Posts: 12
|
Posted: Tue Jun 10, 2003 4:15 am Post subject: |
|
|
How do i add a reply to the user who was voiced?
Something like this? :
#puthelp "PRIVMSG $nick :you have been voiced in $chan" |
|
Back to top |
|
 |
mortician Voice
Joined: 22 Sep 2002 Posts: 37 Location: Tsjakamaka
|
Posted: Tue Jun 10, 2003 4:34 am Post subject: |
|
|
yup (if you remove that # off course )
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. |
|
Back to top |
|
 |
kevie Voice
Joined: 10 Jun 2003 Posts: 12
|
Posted: Tue Jun 10, 2003 5:01 am Post subject: |
|
|
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. |
|
Back to top |
|
 |
ReaLz Op

Joined: 19 Oct 2002 Posts: 121 Location: Athens, Greece
|
Posted: Tue Jun 10, 2003 5:47 am Post subject: |
|
|
heh..... check this:
Code: | ## 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» |
|
Back to top |
|
 |
kevie Voice
Joined: 10 Jun 2003 Posts: 12
|
Posted: Tue Jun 10, 2003 7:18 am Post subject: |
|
|
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.  |
|
Back to top |
|
 |
ReaLz Op

Joined: 19 Oct 2002 Posts: 121 Location: Athens, Greece
|
Posted: Tue Jun 10, 2003 7:57 am Post subject: |
|
|
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» |
|
Back to top |
|
 |
ReaLz Op

Joined: 19 Oct 2002 Posts: 121 Location: Athens, Greece
|
Posted: Tue Jun 10, 2003 7:58 am Post subject: |
|
|
uhm yes you're right...
change the time_proc with this:
Code: | 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» |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Tue Jun 10, 2003 8:00 am Post subject: |
|
|
Please avoid repeating/posting the same topic.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
ReaLz Op

Joined: 19 Oct 2002 Posts: 121 Location: Athens, Greece
|
Posted: Tue Jun 10, 2003 8:01 am Post subject: |
|
|
oops.. I clicked the Back button  _________________ «A fantastic spaghetti is a spaghetti that does not exist» |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Tue Jun 10, 2003 9:08 am Post subject: |
|
|
btw, after the:
Quote: |
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. |
|
Back to top |
|
 |
kevie Voice
Joined: 10 Jun 2003 Posts: 12
|
Posted: Tue Jun 10, 2003 9:13 am Post subject: |
|
|
It works now! Bravo. Anyway, can i put a puthelp "NOTICE $nick :you've been devoiced..." on it after the bot devoiced the user? |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3740 Location: Mint Factory
|
Posted: Tue Jun 10, 2003 9:19 am Post subject: |
|
|
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. |
|
Back to top |
|
 |
kevie Voice
Joined: 10 Jun 2003 Posts: 12
|
Posted: Tue Jun 10, 2003 10:09 am Post subject: |
|
|
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? |
|
Back to top |
|
 |
|