egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MSG Commands?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
CharlesZink
Voice


Joined: 28 Feb 2010
Posts: 12
Location: The Interweb

PostPosted: Tue Mar 16, 2010 8:27 pm    Post subject: MSG Commands? Reply with quote

Not sure if this should be in help or scripting help. My bot won't respond to messages. Here is what I have,

Code:

bind msg - test test_msg

proc test_msg {nick host handle channel testes  } {
putserv "PRIVMSG $nick :It works!"
return 0
}
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Mar 16, 2010 8:53 pm    Post subject: Reply with quote

Your proc's argument list does not match the parameters provided by the msg binding (reading from doc/tcl-commands.doc):
Quote:
(1) MSG
bind msg <flags> <command> <proc>
procname <nick> <user@host> <handle> <text>

Description: used for /msg commands. The first word of the user's
msg is the command, and everything else becomes the text argument.
Module: server


Or, even more obviously, msg's don't come through a channel; drop the "channel" argument from the list.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
CharlesZink
Voice


Joined: 28 Feb 2010
Posts: 12
Location: The Interweb

PostPosted: Fri Mar 19, 2010 1:57 pm    Post subject: ? Reply with quote

Ok Thanks. What is the <user@host> for? What am I suppose to put in there?
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Mar 19, 2010 7:10 pm    Post subject: Reply with quote

You're not supposed to put something there...
The first line explains the bind command - or how to create the trigger.
The second line explains what will be executed when the binding triggers.. That is, assuming we've got this:
Code:
bind msg - Hi do_hi

This creates a "/msg" binding for the word "Hi", and when it triggers it will call the proc "do_hi" with for parameters: the nickname of the user, the user@host of the user, the handle (as your bot sees it) of the user - or * if unknown, and whatever the user wrote after "Hi".

As such, your proc (do_hi) would have to accept 4 arguments (one for each parameter). The first argument will hold the first parameter (the nickname), the second argument the second parameter, etc... Each argument will then be available as a local variable with the same name within the proc.

What you call these arguments is pretty much up to you (as long as you don't use "args", as this is a special argument name for tcl), although using descriptive names usually helps writing good code. A common practice is "nick host hand text", but you could just as easily use "nick userhost handle text", or simply "n u h t". It doesn't matter, as long as you keep track of the names of the arguments/variables in your code...

In your first example, you don't make use of any of the arguments, so the names are really not important, only that you have one for each parameter (total of 4).
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Mon Mar 22, 2010 12:31 pm    Post subject: Reply with quote

/<- CODE

bind pub - !test test_pub
proc test_pub {nick uhost handle chan text } {

->/ CODE

when bind PUB has been specified put channel in there as an arguement being passed on ("chan" in my case). why? because a PUBlic event can be triggered in a CHANNEL, therefore channel is needed

/<- CODE

bind msg - !test test_msg
proc test_msg {nick uhost handle text } {

->/ CODE

when bind MSG has been specified do NOT put the channel arguement in there, as the bind type already says -> its a MSG type which can ONLY be triggered in a msg/query-window, theres NO channel, so NO channel arguement being passed on either.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber