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 

OnJoin Quote System

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


Joined: 07 May 2006
Posts: 4
Location: Netherlands

PostPosted: Sun May 07, 2006 3:12 pm    Post subject: OnJoin Quote System Reply with quote

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


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun May 07, 2006 5:31 pm    Post subject: Reply with quote

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


Joined: 07 May 2006
Posts: 4
Location: Netherlands

PostPosted: Sun May 07, 2006 7:09 pm    Post subject: Reply with quote

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


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun May 07, 2006 7:26 pm    Post subject: Reply with quote

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


Joined: 07 May 2006
Posts: 4
Location: Netherlands

PostPosted: Mon May 08, 2006 3:34 am    Post subject: Reply with quote

Thanks a lot! I will try this inmediatly.
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