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 

Cannot assign proc return value to a variable

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


Joined: 14 Jan 2002
Posts: 269
Location: Canada

PostPosted: Fri Dec 07, 2007 12:29 am    Post subject: Cannot assign proc return value to a variable Reply with quote

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
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Dec 07, 2007 2:40 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Dec 07, 2007 4:47 am    Post subject: Re: Cannot assign proc return value to a variable Reply with quote

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
View user's profile Send private message
z_one
Master


Joined: 14 Jan 2002
Posts: 269
Location: Canada

PostPosted: Fri Dec 07, 2007 7:15 am    Post subject: Reply with quote

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
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Dec 07, 2007 7:50 am    Post subject: Reply with quote

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 Razz
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
View user's profile Send private message
z_one
Master


Joined: 14 Jan 2002
Posts: 269
Location: Canada

PostPosted: Fri Dec 07, 2007 8:01 am    Post subject: Reply with quote

Damn ! Embarassed
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
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