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, reg nick

Help for those learning Tcl or writing their own scripts.
Post Reply
T
TheRudy
Voice
Posts: 6
Joined: Sat Oct 22, 2005 5:16 am

bind msg, reg nick

Post by TheRudy »

Hey

Yes i'm new so sorry for stupid question ;)
And yes, i'm reading http://tcl.activestate.com/man/tcl8.3/TclCmd/proc.htm but it doesn't help me with this problem.

I'm trying to register a nick over PM, posting this on channel has no use since it involves password..

This method works, !regteam some_nick some_pass <--- PUBLIC channel

Code: Select all

bind pub n|- !regteam pub:reg_team

proc pub:reg_team { nickname hostname handle channel arguments } {
	set nick [lindex [split $arguments] 0]
	set password [lindex [split $arguments] 1] 
	puthelp "PRIVMSG $nickname :Nickname: $nick Password: $password"
}

This method doesn't work, PM method!! What am i missing here?!?

Code: Select all

bind msg n !regteam msg:reg_team

proc msg:reg_team { nickname hostname handle channel arguments } {
	set nick [lindex [split $arguments] 0]
	set password [lindex [split $arguments] 1] 
	puthelp "PRIVMSG $nickname :Nickname: $nick Password: $password"
}
btw, the error i get using above MSG code is: wrong # args: should be "reg_team nickname hostname handle channel arguments"

Now if i change "arguments" to "args" the error is not there anymore but there is nothing in the args so the output is: Nickname: Password:
T
TheRudy
Voice
Posts: 6
Joined: Sat Oct 22, 2005 5:16 am

Post by TheRudy »

Code: Select all

bind msg -|- !regteam msg:reg_team

proc msg:reg_team { nickname args } {
	set team_name [lindex [split $args] 2]
	set password [lindex [split $args] 3] 
	puthelp "PRIVMSG $nickname :Password: $password Team name: $team_name"
}
;)
Managed to get it working BUT the output is: Password: somepassword} Team name: {someteamname

with a command: !regteam someteamname somepassword

where did those { in front and at the end } come from??
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Don't split args or use

Code: Select all

bind msg -|- !regteam msg:reg_team

proc msg:reg_team {nick uhost hand arg} {
   set team_name [lindex [split $arg] 0]
   set password [lindex [split $arg] 1]
   puthelp "PRIVMSG $nick :Password: $password Team name: $team_name"
}
T
TheRudy
Voice
Posts: 6
Joined: Sat Oct 22, 2005 5:16 am

Post by TheRudy »

Oh my :)
I'll learn, thanks, it works now just as i wanted!
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

The problem was that you had extra arguments for the msg proc. Read Tcl-commands.doc to know about the binds.
T
TheRudy
Voice
Posts: 6
Joined: Sat Oct 22, 2005 5:16 am

Post by TheRudy »

omg, yes thanks for that, didn't know its there!
Post Reply