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.

Error with colours?

Help for those learning Tcl or writing their own scripts.
Post Reply
k
krzys
Voice
Posts: 5
Joined: Mon Mar 16, 2009 8:48 am

Error with colours?

Post by krzys »

Hi. I wrote script listening to announces of other bot and initiate shell script. This is the source:

Code: Select all

set do "no"
bind pubm - * uploaded
proc uploaded { nick host hand chan arg } {
if {$nick == "BotNick"} {
set got_custom_number [split $arg]
global stamp name cat size value rob
set stamp [lindex $got_custom_number 0 ]
regsub -all {14,1} $stamp "" stamp
putlog "Stamp is $stamp"
if {$stamp == "Znacznik1......:4"} {
set name [lindex $got_custom_number 1 ]
putlog "Name is $name"
set do no
}
if {$stamp == "Zacznik2..:3"} {
set cat [lindex $got_custom_number 1 ]
set do no
putlog "cat is $cat"
}

if {$stamp == "Znacznik3...:4"} {
set do yes
putlog "Now i can do my best!"
}

if {$do == "yes"} {
timer 20 "exec /home/eggdrop/script.sh $name $cat"
putlog "/scriptt.sh $name $cat"
}
}
}
Here is sample log from mIRc with NNS from my channel:

Image

Everytime i see "Stamp is Znacznik1......:4" etc.. but "Name is nazwa" neighter "cat is kategoria" Can you explain me why ?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

You are removing the color codes, but you don't remove the preceding control character. This messes up your string comparisons. Have a look at the stripcodes function. You'll find it documented in the doc/tcl-commands.doc file.
NML_375
Post Reply