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 MSG

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


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Thu Jun 21, 2007 9:45 am    Post subject: Random MSG Reply with quote

I need a small script which will make my bot msg randomly anyone in the channel after every x minutes op/voices are exempted they wont be msged by the bot. One more thing, if the bot msgs someone then it wont msg that nick until that nick parts the channel or quits from IRC.

is it possible that you create me this small script.

Thanks
iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Jun 21, 2007 11:11 am    Post subject: Reply with quote

Code:
set randmsg(time) 10

set randmsg(chan) #channel

set randmsg(msgs) {
 "msg 1"
 "msg 2"
 "msg 3"
}

bind time - * send:msg
bind part - * rem:nick
bind sign - * rem:nick
bind kick - * rem:nick

proc send:msg {m h args} {
 global randmsg
 if {([scan $m %d]+([scan $h %d]*60)) % $randmsg(time)  == 0} {
  set cl [split [string tolower [join [chanlist $randmsg(chan)]]]]
  set cll [llength $cl]
  set n [lindex $cl [rand $cll]]
  while {[set c [expr {[isvoice $n $randmsg($chan)] || [isop $n $randmsg(chan)] || [info exists randmsg(n:$n)]}]]} {
   set i [lsearch -exact $cl $n]
   set cl [lreplace $cl $i $i]
   if {[incr cll -1] < 1} {break}
   set n [lindex $cl [rand $cll]]
  }
  if {!$c} {
   puthelp "privmsg $n :[lindex $randmsg(msgs) [rand [llength $randmsg(msgs)]]]"
   set randmsg(n:$n) 1
  }
 }
}

proc rem:nick {nick uhost hand chan arg {rsn ""}} {
 global randmsg
 if {$rsn != ""} { set nick $arg }
  if {[info exists randmsg(n:[set nick [string tolower $nick]])]} {
  unset randmsg(n:$nick)
 }
}

Edit: Now it should not msg ops/voices and nicks that have already been msged unless they part/quit.
Edit2: Fixed error.
Edit3: Added refresh list on kick as well.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts


Last edited by Sir_Fz on Fri Jun 22, 2007 7:48 pm; edited 5 times in total
Back to top
View user's profile Send private message Visit poster's website
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Jun 22, 2007 4:53 am    Post subject: Reply with quote

Thanks alot SirFz, let me put it in the bot and will let you know if I find any problem.

Thanks once again.

iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Jun 22, 2007 8:39 am    Post subject: Reply with quote

The problem is that the bot is msging itself and also it's messagin the ops and voiced users. How can I make it not msg itself and op/voice users.

also it is msging users always, can't we restrict it so that if the bot msged one user it shouldnt msg him/her anymore until that nick parts or quits


I did this to find out:

Code:
  puthelp "privmsg $n :[lindex $randmsg(msgs) [rand [llength $randmsg(msgs)]]]"
  putlog "Just msged $n"
  set randmsg(n:$n) 1


I found out:

Code:
[17:37] <ShetanGal> [17:38] Just msged lair
[17:38] <ShetanGal> [17:39] Just msged cancerian
[17:39] <ShetanGal> [17:40] Just msged cheetah
[17:40] <ShetanGal> [17:41] Just msged shetangal
[17:41] <ShetanGal> [17:42] Just msged lair
[17:42] <ShetanGal> [17:43] Just msged alone_m_isb


You see the nickname lair comes 2 times lair is an op too and bot msges itself as it's nickname is ShetanGal.


Thanks
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jun 22, 2007 10:14 am    Post subject: Reply with quote

Try the edited code now.
_________________
Follow me on GitHub

- Opposing

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


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Jun 22, 2007 2:07 pm    Post subject: Reply with quote

thanks alot, it's working smooth now Smile

Thank you soo much

iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Jun 22, 2007 6:01 pm    Post subject: Reply with quote

Code:
[03:02] <ShetanGal> [03:03] Tcl error [send:msg]: random limit must be greater than zero
[03:03] <ShetanGal> [03:04] Tcl error [send:msg]: random limit must be greater than zero
[03:04] <ShetanGal> [03:05] Tcl error [send:msg]: random limit must be greater than zero

This is what I get in DCC any idea?

thanks
iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jun 22, 2007 6:43 pm    Post subject: Reply with quote

I edited the code and the error must not appear anymore.
_________________
Follow me on GitHub

- Opposing

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


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Jun 22, 2007 7:38 pm    Post subject: Reply with quote

Thanks alot, it's working perfect now.

Thank you soo much Smile

iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jun 22, 2007 7:49 pm    Post subject: Reply with quote

I've edited it again and added removing the nick from the already-msged nicks if it is kicked.
_________________
Follow me on GitHub

- Opposing

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


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Sun Jun 24, 2007 6:15 am    Post subject: Reply with quote

Thank you soo much SirFz, I really appreciate your efforts.

Thank You

iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
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