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 msg input to be a string?

Help for those learning Tcl or writing their own scripts.
Post Reply
f
flufsor
Voice
Posts: 4
Joined: Thu Jan 22, 2009 6:45 pm

Bind msg input to be a string?

Post by flufsor »

Hi,
I am trying to get my first script ready but i can't,
could use some help its probably very stupid.

Code: Select all

set love "Do you love me Faith?"
bind pub - $love pub:love
proc pub:love {nick uhost hand chan args} {

puthelp "PRIVMSG $chan :I love you so hard $nick, you sexy beast !!!"

}
I just want the bot to respond on the string Do you love me Faith?
But i have no idea how :)
help a newby :)
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

we all have to start somewhere :)
I suggest taking a look at the tcl-commands.doc that comes with your eggdrop.. lot's of nice commands in there, one you might find interesting is
(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. If the proc returns 1, Eggdrop will not log
| the message that triggered this bind. PUBM binds are processed
| before PUB binds. If the exclusive-binds setting is enabled,
| PUB binds will not be trigged by text that a PUBM bind has
| already handled.
Module: irc
one thing though:

Code: Select all

proc pub:love {nick uhost hand chan args} { 
args has a special meaning in tcl and I would us something like arg or text until you have properly learned how to handle args.
It will make no difference on your script since you are not using args further anyway, but keep it in mind if you should continue writing scripts
Elen sila lúmenn' omentielvo
f
flufsor
Voice
Posts: 4
Joined: Thu Jan 22, 2009 6:45 pm

Post by flufsor »

Still don't get it, could you post an example maybe ?
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

bind pubm - "* $love" pub:love 
not that different as you see
Elen sila lúmenn' omentielvo
Post Reply