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.

Global text-string ignore (for stats.mod/megahal/alice)

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
D
DarkStar723
Voice
Posts: 11
Joined: Fri Sep 09, 2005 7:30 pm

Global text-string ignore (for stats.mod/megahal/alice)

Post by DarkStar723 »

Ive been trying to work up a full function text-string ignore in tcl for awhile, mainly to ignore wbs/winamp display/whatever else i can think of for stats.mod, alice, and megahal. I run several bots using these, but havent managed to get a consistent ignore going for them. Binding a text-string i want to ignore to a function that does nothing seems to work about 15% of the time, its only 15% because getting it to call that bind before anything else is kinda tricky (seems to be just luck).

Now, im kinda lost as to how to get this working, im wondering if im just wasting my time on it, it seems like im gonna have to script something individually for each module/script that causes problems, which i doubt im smart enough to pull off, and it seems kind of inefficient.

So, can anyone think of a good way to go about creating a (hopefully global) text-string ignore? Or, could help me out with scripting something for each module/script individually.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

problem is that ignoring totally will involve also ignoring for flood control. I suggest removing all binds for the modules you dont want these lines, write a prog binding to pubm and call the functions within the proc only if the text is fine.

example:

Code: Select all

set pubmlist {pubm:stat}
set actionlist {ctcp:stat}

foreach functionname $pubmlist {
   unbind pubm -|- * $functionname
}
foreach functionname $actionlist {
   unbind ctcp -|- ACTION $functionname
}
unset functionname
bind pubm -|- * filteredpubm
bind ctcp -|- ACTION filteredaction

proc filteredpubm {n u h c t} {
   if {![string match -nocase {*is playing*} $t]} {
      foreach f $::pubmlist {
         eval [list $f $n $u $h $c $t]
      }
   }
   return 0
}

proc filteredaction {n u h d k t} {
   if {[validchan $d] && ![string match -nocase {*is playing*} $t]} {
      foreach f $::actionlist {
         eval [list $f $n $u $h $d $k $t]
      }
   }
   return 0
}
modify/expand the string matchs as neccessary. I'd recommned to not use a regex on such binds.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
D
DarkStar723
Voice
Posts: 11
Joined: Fri Sep 09, 2005 7:30 pm

Post by DarkStar723 »

oh wow thanks, didnt expect to get a response that quickly. Well, to be honest, i never even use the flood control anymore, i mean, i have some people who actually type (not pasting, actual typing) so fast that they hit the networks excess flood limit fairly regularly. But, thanks for this example, ill try it instead, just in case i want to mess with flood control again, hopefully im smart enough to modify it for each individual module/script, haha.
Post Reply