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.

bind pub - * doesn't work

Help for those learning Tcl or writing their own scripts.
Post Reply
b
boehmi
Voice
Posts: 14
Joined: Sat Apr 11, 2009 7:55 am
Location: Germany

bind pub - * doesn't work

Post by boehmi »

I already have another problem ;)

I want my bot to evaluate any string that is written to the channel with a procedure...
i used

Code: Select all

bind pub - * procedure
or
bind pub - "*" procedure
but he binds the string "*" to procedure and not the wildcard *

What's my mistake?
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

use pubm for that
(6) PUBM (stackable)
bind pubm <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <text>

Description: just like MSGM, except it's triggered by things said
on a channel instead of things /msg'd to the bot. The mask is
matched against the channel name followed by the text and can
contain wildcards. Also, if a line triggers a PUB bind, it will not
trigger a PUBM bind.
Module: irc
F
Fill
Halfop
Posts: 80
Joined: Sun Jan 18, 2009 6:08 pm

Post by Fill »

Well I don't like using pub, so I'd suggest you to use pubm (public text matching)

If you want to bind all channels, you'd have this:

Code: Select all

bind pubm "* *" proc1
If you only want to bind in a specific chan, you must do it like this:

Code: Select all

bind pubm "#channel1 *" proc1
proc1 will hava to be called with the arguments nick uhost hand chan text
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

A suggestion when creating more complex patterns, use the % wildcard to match any channel instead of *.
The reason for this is that * matches 0 or more characters, including whitespaces, while % will match 1 word. The advantage of this usage becomes apparent when dealing with more complex patterns such as this:

Code: Select all

#We try to catch anything that starts with !hello world
bind pub "* !hello world*" pubm:hello
#Looks good eh? until we realize it will also trigger on "Blah !hello world", which we did not want!

bind pub "% !hello world*" pubm:hello
#Now, this works as intended. It'll only trigger when the text starts with "!hello world", not whenever it's anywhere in the text.
This could also be extended to only trigger in local channels (&channel) by using "&% !hello world*", and so on...
NML_375
Post Reply