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.

Quoteengine !quote modification

Old posts that have not been replied to for several years.
Locked
j
jamitupya
Voice
Posts: 3
Joined: Thu Jul 08, 2004 7:18 am

Quoteengine !quote modification

Post by jamitupya »

Hey hey,
Im using the QuoteEngine version $quote_version by JamesOff (http://www.jamesoff.net/go/quoteengine)"
and i was wondering if its possible to modify the quote_rand function to not just do a random quote but be able to specify a quote number..

Find of like a hybrid quote_rand and quote_fetch

so that yo could do a !quote and get a random quote or alt. do a !quote <no.> and get that quote number ?

proc quote_rand { nick host handle channel text } {
global db_handle quote_noflags

if {![channel get $channel quoteengine]} {
return 0
}

if [matchattr $handle $quote_noflags] { return 0 }

set where_clause "WHERE channel='$channel'"
if [regexp -- "--?all" $text] {
set where_clause ""
}

if [regexp -- "--?c(hannel)?( |=)(.+)" $text matches skip1 skip2 newchan] {
set where_clause "WHERE channel='[mysqlescape $newchan]'"
}

set sql "SELECT * FROM quote_text $where_clause ORDER BY RAND() LIMIT 1"
putloglev d * "QuoteEngine: executing $sql"

set result [mysqlquery $db_handle $sql]

if {[set row [mysqlnext $result]] != ""} {
set id [lindex $row 0]
set quote [lindex $row 3]
set by [lindex $row 1]
set when [clock format [lindex $row 5] -format "%Y/%m/%d %H:%M"]

puthelp "PRIVMSG $channel :\[\002$id\002\] $quote"
} else {
puthelp "PRIVMSG $channel :Couldn't find a quote :("
}
mysqlendquery $result
}
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

ask the author...
Elen sila lúmenn' omentielvo
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: Quoteengine !quote modification

Post by user »

jamitupya wrote:Im using the QuoteEngine version $quote_version
can't read "quote_version": no such variable
Have you ever read "The Manual"?
Locked