im testing this tcl to check for certain words in a sentence and count how many times its used
but for some reason only 1 check seems to work as expected and the other doesnt while they basically check for the same thing (lines used)
Code: Select all
bind pubm - * Text:Lines-Check:Chan
proc Text:Lines-Check:Chan {nick uhost hand chan text} {
set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
if {![string match -nocase "*specific text here to check for*" $text]} { return 0 }
set RLyCheck 4:2
global relaychk
if {![info exists relaychk([set QfQ $chan])]} { set relaychk($QfQ) 0 }
after [expr {[lindex [split $RLyCheck :] 1]*1000*1}] [list incr relaychk($QfQ) -1]
incr relaychk($QfQ)
if {$relaychk($QfQ) >= [lindex [split $RLyCheck :] 0] && $relaychk($QfQ) < 10} {
if {![string match *m* [lindex [getchanmode "$chan"] 0]]} { pushmode $chan "+m" }
}
if {$relaychk($QfQ) >= 6 && $relaychk($QfQ) < 10} { if {![string match *R* [lindex [getchanmode "$chan"] 0]]} { pushmode $chan "+R" } }
}
this line seems to work fine and as expected:
Code: Select all
if {$relaychk($QfQ) >= [lindex [split $RLyCheck :] 0] && $relaychk($QfQ) < 10} {
if {![string match *m* [lindex [getchanmode "$chan"] 0]]} { pushmode $chan "+m" }
}
Code: Select all
if {$relaychk($QfQ) >= 6 && $relaychk($QfQ) < 10} { if {![string match *R* [lindex [getchanmode "$chan"] 0]]} { pushmode $chan "+R" } }