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.

help again please..!!

Old posts that have not been replied to for several years.
Locked
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

help again please..!!

Post by ^DooM^ »

Hi again this bit of script is really starting to annoy :)

I'm trying to get my bot to display a notice saying "I'm not in #channel" when the user triggers the procedure. in my tcl i have set a channel which works great with the rest of the script when the bot is in the set channel. but when i remove the bot id like it to notice the user of the trigger when its not in the set channel.

Following so far? im glad one of us is :lol:

heres the part of my code which might explain a bit better..

Code: Select all

set keychan "#testchan"

if {[onchan $botnick $chan] != $keychan} {
        putserv "NOTICE $nick :$nick, I Don't monitor $keychan"
        return
    }
the error that is returned is this.
Tcl error [get_key]: invalid channel: #testchan

Thanks again. Jon.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Check out 'validchan' (explained in tcl-commands.doc)
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

validchan

Post by ^DooM^ »

Check out 'validchan' (explained in tcl-commands.doc)
i read the small explination in that doc which i didnt know existed till now. thanks :) basically all it said was that using validchan returns a 1 or a 0 depending if the bot is in channel or not which is what i need but it still throws up the same error as before when using it

Code: Select all

if {[validchan $chan] == "0"} {
            putserv "NOTICE $nick :$nick I'm not on $chan"
            return
    }
Jon.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: validchan

Post by user »

^DooM^ wrote:it still throws up the same error as before
Then the error must be some place else. Did you read the entire error message? (while executing ...something...)
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

error

Post by ^DooM^ »

the bot doesnt die it just throws up this in dcc

[23:42] Tcl error [get_key]: invalid channel: #testchan

not to worry im sure ill get there in the end. thanks again for your help

Jon
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

A few ideas

Post by user »

Code: Select all

proc getKey {chan} {
	if {![validchan $chan]||![botonchan $chan]} {return "I'm not on $chan"}
	if {![string match *k* [getchanmode $chan]]} {return "There's no key on $chan"}
	if {![botisop $chan]} {return "I'm not oped on $chan (i need to be to see the key :P)"}
	return "The key on $chan is '[lindex [split [getchanmode $chan]] 1]' :)"
}
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: A few ideas

Post by strikelight »

user wrote:

Code: Select all

proc getKey {chan} {
	if {![validchan $chan]||![botonchan $chan]} {return "I'm not on $chan"}
	if {![string match *k* [getchanmode $chan]]} {return "There's no key on $chan"}
	if {![botisop $chan]} {return "I'm not oped on $chan (i need to be to see the key :P)"}
	return "The key on $chan is '[lindex [split [getchanmode $chan]] 1]' :)"
}
Of course, if there is a limit (+l) on the chan, and happens to be before the +k, then you will be returning the chanlimit instead of the key :wink:
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: A few ideas

Post by user »

strikelight wrote: Of course, if there is a limit (+l) on the chan, and happens to be before the +k, then you will be returning the chanlimit instead of the key :wink:
Nope. (the key is always the second element if there's a key)
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

THANKYOU

Post by ^DooM^ »

thankyou so much user. :D :D :D

you were right it was something else in my proc that i had that was throwing the error up. i had loads of usless stuff in it heh

i can tell im a newbie /me bows down :lol:

Seriously tho thanks again.

Jon.
p.s. (i also tested it with the limit and it still retrieves the key)
thanks for mentioning it tho i never thought to test that :)
Locked