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.

script help

Help for those learning Tcl or writing their own scripts.
Post Reply
A
Ace-T
Halfop
Posts: 82
Joined: Tue Aug 29, 2006 7:25 am

script help

Post by Ace-T »

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: Select all

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"
    }
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I'd probably go for something like this:

Code: Select all

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
A
Ace-T
Halfop
Posts: 82
Joined: Tue Aug 29, 2006 7:25 am

Post by Ace-T »

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?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

 if {[lsearch -exact $ace_channels [string tolower $chan]] < 0} {
A
Ace-T
Halfop
Posts: 82
Joined: Tue Aug 29, 2006 7:25 am

Post by Ace-T »

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: Select all

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
A
Ace-T
Halfop
Posts: 82
Joined: Tue Aug 29, 2006 7:25 am

Post by Ace-T »

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: Select all

    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
Post Reply