| View previous topic :: View next topic |
| Author |
Message |
Ace-T Halfop
Joined: 29 Aug 2006 Posts: 82
|
Posted: Mon Jan 29, 2007 8:20 am Post subject: script help |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Jan 29, 2007 3:18 pm Post subject: |
|
|
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 |
|
 |
Ace-T Halfop
Joined: 29 Aug 2006 Posts: 82
|
Posted: Mon Jan 29, 2007 10:03 pm Post subject: |
|
|
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
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Jan 29, 2007 10:19 pm Post subject: |
|
|
| Code: | | if {[lsearch -exact $ace_channels [string tolower $chan]] < 0} { |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Ace-T Halfop
Joined: 29 Aug 2006 Posts: 82
|
Posted: Tue Jan 30, 2007 7:16 am Post subject: |
|
|
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 |
|
 |
Ace-T Halfop
Joined: 29 Aug 2006 Posts: 82
|
Posted: Tue Jan 30, 2007 1:43 pm Post subject: |
|
|
managed to do the first one but tried second but cant seem to do it
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 |
|
 |
|