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.

text lines check

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

text lines check

Post by simo »

Greetings,

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" }
	}
but this line works for a while and then starts to be non-responsive only after a restart it starts working again and i cant figure out why:

Code: Select all

if {$relaychk($QfQ) >= 6 && $relaychk($QfQ) < 10} { if {![string match *R* [lindex [getchanmode "$chan"] 0]]} { pushmode $chan "+R" } }
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Re: text lines check

Post by simo »

Or would there be a better way of counting text lines?
Post Reply