| View previous topic :: View next topic |
| Author |
Message |
heman Voice
Joined: 30 Dec 2006 Posts: 13
|
Posted: Sat Feb 03, 2007 8:21 am Post subject: different announcement by different count |
|
|
When someone query's the db it returns announcement to irc channel: like this:
| Quote: |
<botname> sending latest results:
|
(the max results is set to 10)
Now I want to let it announce how many records of that query it has found in the db, so i added to the script:
| Code: |
set cnt [mysqlsel $db "select count(*) from $table WHERE nm = '$text';" -list]
|
And changed the announcement in:
| Quote: |
<botname> found ## results: sending latest results:"
|
Now what I liked to add is it will announce the ## results, someting like:
| Quote: |
<botname> found 1 result: sending latest 1 result:"
<botname> found 5 result: sending latest 5 results:"
<botname> found 23 result: sending latest 10 result:"
etc.
|
I was thinking to do it someting like this:
| Code: |
if ........ {
putserv "PRIVMSG $chan :found $cnt result: sending latest 1 result:"
} elseif {
......... {
putserv "PRIVMSG $chan :found $cnt results: sending latest 2 results:"
} elseif {
......... {
putserv "PRIVMSG $chan :found $cnt results: sending latest 3 results:"
etc
} else {
......... {
putserv "PRIVMSG $chan :found $cnt results: sending latest 10 result:"
}
|
But I have no idea what I have to fill in on the .......
Anyone can help me?
Thanks |
|
| Back to top |
|
 |
dwickie Halfop
Joined: 21 Aug 2004 Posts: 76 Location: /pub/beer
|
Posted: Sat Feb 03, 2007 9:42 am Post subject: |
|
|
something like that?
| Code: | set maxresults 10
if {$cnt>=$maxresults} {
putserv "PRIVMSG $chan :found $cnt results: sending latest $maxresults result:"
} else {
putserv "PRIVMSG $chan :found $cnt results: sending result:"
} |
|
|
| Back to top |
|
 |
heman Voice
Joined: 30 Dec 2006 Posts: 13
|
Posted: Sat Feb 03, 2007 9:55 am Post subject: |
|
|
that seems to work to
Thanks |
|
| Back to top |
|
 |
|