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 

different announcement by different count

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
heman
Voice


Joined: 30 Dec 2006
Posts: 13

PostPosted: Sat Feb 03, 2007 8:21 am    Post subject: different announcement by different count Reply with quote

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
View user's profile Send private message
dwickie
Halfop


Joined: 21 Aug 2004
Posts: 76
Location: /pub/beer

PostPosted: Sat Feb 03, 2007 9:42 am    Post subject: Reply with quote

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
View user's profile Send private message
heman
Voice


Joined: 30 Dec 2006
Posts: 13

PostPosted: Sat Feb 03, 2007 9:55 am    Post subject: Reply with quote

that seems to work to Very Happy

Thanks
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 -> Scripting Help 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