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 

script help

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


Joined: 29 Aug 2006
Posts: 82

PostPosted: Mon Jan 29, 2007 8:20 am    Post subject: script help Reply with quote

hey i need to get my script to report to a command but only to two ov the 3 chanels i own.. but it reports to them all and i dont want this how can i make this go to my two channels..

#Ace and #AceStats and not #AceBots

heres the command i have

Code:

proc search_info { nick host handle channel text} {
 
  global db_handle
  global maxresults

if {$text == ""} {

      putquick "PRIVMSG $channel : Use: !stats <stats> to search"
return 0
}

ON THIS LINE IS WHERE THE COMMAND SEARCHS MYSQL

            putquick "PRIVMSG $channel : Stats :: $stats"
  } else {
            putquick "PRIVMSG $channel : No matches found in Database"
    }
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Jan 29, 2007 3:18 pm    Post subject: Reply with quote

I'd probably go for something like this:
Code:

set ace_channels [list #ace #acestats]
proc search_info {nick host hand chan text} {
 global db_handle maxresults ace_channels
 if {[lsearch -exact $ace_channels [string tolower $chan] < 0} {
  return 1
 }
 #Rest of code continues here
 .....

Any channel your script should be reporting on needs to be added to the ace_channels list. Keep in mind that you will have to enter any channels in this list in lowercase only, as lsearch is case-sensitive.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Ace-T
Halfop


Joined: 29 Aug 2006
Posts: 82

PostPosted: Mon Jan 29, 2007 10:03 pm    Post subject: Reply with quote

Tcl error [search_info]: bad option "#ace": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -inline, -integer, -not, -real, -regexp, -sorted, or -start

just get that Sad


you missed a ]

so i added it like so

if {[lsearch -exact $ace_channels [string tolower $chan] < 0]} {

would this cause it?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Jan 29, 2007 10:19 pm    Post subject: Reply with quote

Code:
 if {[lsearch -exact $ace_channels [string tolower $chan]] < 0} {

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Ace-T
Halfop


Joined: 29 Aug 2006
Posts: 82

PostPosted: Tue Jan 30, 2007 7:16 am    Post subject: Reply with quote

2 last questions

1. how can i add the data into the announce from mysql... the dates in mysql but not pulling the data to chanel

and

2.

if the bot doesnt update the users score and a channel admin need to update it maually then how could we do it so it will add the day/time of our choose

currently we have

Code:

set sql "INSERT INTO stats VALUES(null, '[mysqlescape $score]', '[mysqlescape $game]', now())"


but that puts the now date into mysql but we need to add for a few days before so we are having to go into mysql and edit manually

so we would need to add the date like so 01/01/2007 11:36:00
Back to top
View user's profile Send private message
Ace-T
Halfop


Joined: 29 Aug 2006
Posts: 82

PostPosted: Tue Jan 30, 2007 1:43 pm    Post subject: Reply with quote

managed to do the first one but tried second but cant seem to do it Sad

spend hours trying but it still adds the time value for the current time


edit: this is what i thought ov

Code:

    set cat [lindex [split $text] 1]
    set game [lindex [split $text] 2]
    set time [lindex [split $text] 3]

set sql "INSERT INTO stats VALUES(null, '[mysqlescape $game]', '[mysqlescape $cat]', '[mysqlescape $time]')"


and the add stats function is

!add Puzzle Tetris date then time

eg !add Puzzle Tetris 2007-01-12 19:31:12

i need it to add it by text and not a date and time function


edit: half way there... now just the date and time is adding it in as 2007-01-12 00:00:00 .. the date i added was correct but not the time but the date and time need to be in the same filed
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