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.

OnJoin Quote System

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
J
Jcb
Voice
Posts: 4
Joined: Sun May 07, 2006 3:05 pm
Location: Netherlands

OnJoin Quote System

Post by Jcb »

Hello!

I've been looking for a script for my eggdrop that automaticly stores quotes from people in my channel. Once a person leaves and later joins the same channel again, I'd like the eggdrop to randomly pick one quote that person has said and spit it out in the channel.

A lot of quote systems I have encountered are systems where you can only add quotes, eg: !add <quote>. That's is not what I'm looking for. Any help would be greatly appreciated!

Jcb.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

So, you want your bot to add every line said by every user to a file?
J
Jcb
Voice
Posts: 4
Joined: Sun May 07, 2006 3:05 pm
Location: Netherlands

Post by Jcb »

Sir_Fz wrote:So, you want your bot to add every line said by every user to a file?
Thats too much obviously. Is there a way to work with chances? Like 5% it stores the quote?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try:

Code: Select all

bind time - ?0* savequotes
bind pubm - * addquote
bind join - * printquote

if {![file exists scripts/quotelist.txt]} { close [open scripts/quotelist.txt w] }
set quotelist [split [read [set qlfile [open scripts/quotelist.txt]]] \n][close $qlfile]

proc savequotes args {
 global quotelist
 set f [open scripts/quotelist.txt w]
 foreach e $quotelist {
  if {$e != ""} { puts $f $e }
 }
 close $f
}

proc addquote {nick uhost hand chan arg} {
 global quotelist
 set nick [string tolower $nick]
 if {[rand 100] < 5} {
  if {[lsearch $quotelist "$nick $arg"] == -1} {
   lappend quotelist "$nick $arg"
  }
 }
}

proc printquote {nick uhost hand chan} {
 global quotelist
 set nick [string tolower $nick]
 if {[lsearch $quotelist "$nick *"] != -1} {
  set quote [getquote $nick]
  puthelp "privmsg $chan :$nick : $quote"
 }
}

proc getquote n {
 global quotelist
 foreach e $quotelist {
  if {[lindex [split $e] 0] == $n} {
   lappend nq [join [lrange [split $e] 1 end]]
  }
 }
 return [lindex $nq [rand [llength $nq]]]
}
J
Jcb
Voice
Posts: 4
Joined: Sun May 07, 2006 3:05 pm
Location: Netherlands

Post by Jcb »

Thanks a lot! I will try this inmediatly.
Post Reply