| View previous topic :: View next topic |
| Author |
Message |
z_one Master

Joined: 14 Jan 2002 Posts: 269 Location: Canada
|
Posted: Fri Dec 07, 2007 12:29 am Post subject: Cannot assign proc return value to a variable |
|
|
Ok I'm writing a script with many functions but, assuming all variables in the code below are declared and the proc notice:nochannotice calls none:bankickthenick, why do I get the following error when a nick called tester (for example) sends a channel notice:
Tcl error: invalid command name "tester!*@*""
| Code: | bind notc - "*" notice:nochannotice
proc none:banmask {p_chan p_nick p_bantype} {
set l_uhost [getchanhost $p_nick $p_chan]
switch -- $p_bantype {
1 { set l_banmask "$p_nick!*@*"}
2 { set l_banmask "*!*@[lindex [split $l_uhost @] 1]" }
3 { set l_banmask "*!*$l_uhost" }
default { set l_banmask "*!*@[lindex [split $l_uhost @] 1]" }
}
if {[$l_banmask" == "*!*@*"]} {
return 0
} else {
return $l_banmask
}
}
proc none:bankickthenick {p_nick p_chan} {
if {[botisop $p_chan] && [onchan $p_nick $p_chan]} {
set l_banmask [none:banmask $l_chan $l_nick 1]
putserv "mode $l_chan +b $l_banmask"
putserv "kick $l_chan $p_nick"
}
} |
isn't the following line | Code: | | set l_banmask [none:banmask $l_chan $l_nick 1] |
the correct way to do this if I want to assign the return value none:banmask to the variable l_banmask ? |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Fri Dec 07, 2007 2:40 am Post subject: |
|
|
Did you bother reading the FAQ and the Sticky about how to get proper DEBUG data?
You didn't tell us the full error, and I don't feel like sitting here figuring out your script's logic, so please post the output of .set errorInfo (after reading the FAQ section dealing with finding bugs/script errors, and reading the Sticky about how to help us help you.)
And if you come back and say "all .set errorInfo says is "What? You Need Help?"" we're going to collectively neuter you  |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri Dec 07, 2007 4:47 am Post subject: Re: Cannot assign proc return value to a variable |
|
|
| z_one wrote: | Tcl error: invalid command name "tester!*@*""
...
| Code: | | if {[$l_banmask" == "*!*@*"]} {...} |
|
Why did you put brackets around that expression? _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
z_one Master

Joined: 14 Jan 2002 Posts: 269 Location: Canada
|
Posted: Fri Dec 07, 2007 7:15 am Post subject: |
|
|
User, because it was saying "invalid command name" so I though it was trying to evaluate the user's ban mask as a command.
rosc2112, thanks. I'll check the threads you indicated. |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri Dec 07, 2007 7:50 am Post subject: |
|
|
| z_one wrote: | | User, because it was saying "invalid command name" so I though it was trying to evaluate the user's ban mask as a command. |
That's exactly what it is doing and it is BECAUSE OF THE BRACKETS (not braces), so get rid of them
This is extremely basic stuff... read http://tcl.tk/man/tcl8.4/TclCmd/Tcl.htm#M10 _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
z_one Master

Joined: 14 Jan 2002 Posts: 269 Location: Canada
|
Posted: Fri Dec 07, 2007 8:01 am Post subject: |
|
|
Damn !
Lol it's been years since I last wrote TCL code. I guess I need to re-read that stuff and refresh my memory !
Thanks guys. |
|
| Back to top |
|
 |
|