| View previous topic :: View next topic |
| Author |
Message |
basa Voice
Joined: 14 May 2007 Posts: 3
|
Posted: Mon May 14, 2007 2:33 pm Post subject: Random message from file to user (bind) and rk - please help |
|
|
Hello , im totally lame with tcl scripting but need two i think simple scripts. If someone can help will be nice. I try explain what this scripts should works.
Script 1: Random message from file to user (bind)
Script usage should looks like :
!msg Agnes88
bot reaction
<bot> Agnes88 here random text from list
script should get line from list in file or list writed in this tcl
Script 2 : Simple Random Kick (bind)
using in channel :
!rk
bot reaction:
bot should kick random person from channel with reason chosed random line from file or from this tcl script,
script can use any person in chann and can kick all user ranges (ops too also person who writed !rk)
Very big thanks for help and sorry for poor english |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon May 14, 2007 4:57 pm Post subject: |
|
|
| Code: | set textlist {
"Line 1 here..."
"Another line here..."
"again here..."
}
bind pub - !msg rand:cmd
bind pub - !rk rand:cmd
proc rand:cmd {nick uhost hand chan arg} {
global textlist lastbind
set msg [lindex $textlist [rand [llength $textlist]]]
set ns [chanlist $chan]
switch -- $lastbind {
"!msg" {
puthelp "privmsg [lindex [split $arg] 0] :$msg"
}
"!rk" {
set n [lindex $ns [rand [llength $ns]]]
puthelp "kick $chan $n :$msg"
}
}
} |
the !rk command might kick the bot itself as well. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
basa Voice
Joined: 14 May 2007 Posts: 3
|
Posted: Tue May 15, 2007 4:20 am Post subject: |
|
|
thank you Sir_Fz !rk command workin fine
but !msg put line to private msg , how change to chan message ?
i try change line
puthelp "privmsg [lindex [split $arg] 0] :$msg"
to
puthelp "privmsg $chan [lindex [split $arg] 0] :$msg"
but not works , in results bot write only nick name in chan without message.
thx |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue May 15, 2007 5:00 am Post subject: |
|
|
| Code: | | puthelp "privmsg $chan :[lindex [split $arg] 0] $msg" |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
basa Voice
Joined: 14 May 2007 Posts: 3
|
Posted: Tue May 15, 2007 5:18 am Post subject: |
|
|
thank you now workin fine  |
|
| Back to top |
|
 |
|