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.

can you help?

Help for those learning Tcl or writing their own scripts.
Post Reply
p
pektek
Halfop
Posts: 67
Joined: Sat Jul 01, 2023 4:51 pm

can you help?

Post by pektek »

authorized external command cannot be used in the channel

.kickradyo

I get an error when I type

Code: Select all

## Write the Channel to Which the Command Will Be Valid Here..

set admin_chan "#DJ"

## We don't touch anything else. I'll take care of the rest. ;)

bind pub - .kickradyo kickradyo:msg
proc kickradyo:msg {n u h c a} {
	global botnick admin_chan
	set kickradyo:msg [lindex $a ]
	if {[onchan $n $admin_chan]==1} {
		putserv "PRIVMSG operserv : kickradyo $kickradyo:msg"
	}
        if {[onchan $n $admin_chan]==0} {
	putserv "MODE $c +b $n"
	putserv "KICK $c $n You are not authorized to use this command!"
	putserv "PRIVMSG $admin_chan 5$n 2.kickradyo 14tried to use the command!"    
        }
      }
putlog "Forbidden.tcl made by Xadd1"
error

[00:38:17] Tcl error [kickradyo:msg]: can't read "kickradyo": no such variable
User avatar
CrazyCat
Revered One
Posts: 1368
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: can you help?

Post by CrazyCat »

As said and re-said: type .set errorInfo when it occures to give us all the context. And take care to the capital "i" in errorInfo.

I think your trouble is $kickradyo:msg which must be changed to ${kickradyo:msg}, but I won't test for you.
p
pektek
Halfop
Posts: 67
Joined: Sat Jul 01, 2023 4:51 pm

Re: can you help?

Post by pektek »

Thank you but I don't understand CrazyCat

What's your problem?
Don't write anything if you're not going to help .
User avatar
CrazyCat
Revered One
Posts: 1368
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: can you help?

Post by CrazyCat »

I simply said that when the error occures, you MUST type .set errorInfo in party-line to have a detailled report about the error, and probably the exact line where the error is.

And I gave you an untested solution :
Replace
putserv "PRIVMSG operserv : kickradyo $kickradyo:msg"
With:
putserv "PRIVMSG operserv : kickradyo ${kickradyo:msg}"
So don't say I didn't try to help.

Small test FYI

Code: Select all

.tcl set kickradyo:msg "I'm a test"
Tcl: I'm a test
.tcl putlog $kickradyo:msg
Tcl error: can't read "kickradyo": no such variable
.tcl putlog ${kickradyo:msg}
[10:46:24] I'm a test
p
pektek
Halfop
Posts: 67
Joined: Sat Jul 01, 2023 4:51 pm

Re: can you help?

Post by pektek »

Thank you for your help CrazyCat
Post Reply