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 

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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
basa
Voice


Joined: 14 May 2007
Posts: 3

PostPosted: Mon May 14, 2007 2:33 pm    Post subject: Random message from file to user (bind) and rk - please help Reply with quote

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


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon May 14, 2007 4:57 pm    Post subject: Reply with quote

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


Joined: 14 May 2007
Posts: 3

PostPosted: Tue May 15, 2007 4:20 am    Post subject: Reply with quote

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


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue May 15, 2007 5:00 am    Post subject: Reply with quote

Code:
puthelp "privmsg $chan :[lindex [split $arg] 0] $msg"

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
basa
Voice


Joined: 14 May 2007
Posts: 3

PostPosted: Tue May 15, 2007 5:18 am    Post subject: Reply with quote

thank you now workin fine Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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