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.

Random message from file to user (bind) and rk - please help

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
basa
Voice
Posts: 3
Joined: Mon May 14, 2007 1:01 pm

Random message from file to user (bind) and rk - please help

Post by basa »

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

Post by Sir_Fz »

Code: Select all

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.
b
basa
Voice
Posts: 3
Joined: Mon May 14, 2007 1:01 pm

Post by basa »

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

Post by Sir_Fz »

Code: Select all

puthelp "privmsg $chan :[lindex [split $arg] 0] $msg"
b
basa
Voice
Posts: 3
Joined: Mon May 14, 2007 1:01 pm

Post by basa »

thank you now workin fine :)
Post Reply