| View previous topic :: View next topic |
| Author |
Message |
Jcb Voice
Joined: 07 May 2006 Posts: 4 Location: Netherlands
|
Posted: Sun May 07, 2006 3:12 pm Post subject: OnJoin Quote System |
|
|
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. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun May 07, 2006 5:31 pm Post subject: |
|
|
So, you want your bot to add every line said by every user to a file? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Jcb Voice
Joined: 07 May 2006 Posts: 4 Location: Netherlands
|
Posted: Sun May 07, 2006 7:09 pm Post subject: |
|
|
| 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? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun May 07, 2006 7:26 pm Post subject: |
|
|
Try:
| Code: | 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]]]
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Jcb Voice
Joined: 07 May 2006 Posts: 4 Location: Netherlands
|
Posted: Mon May 08, 2006 3:34 am Post subject: |
|
|
| Thanks a lot! I will try this inmediatly. |
|
| Back to top |
|
 |
|