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.

botonchan problems

Old posts that have not been replied to for several years.
Locked
P
ProXy
Op
Posts: 126
Joined: Sun Aug 11, 2002 3:09 pm

botonchan problems

Post by ProXy »

Hello,

I simply want to check if my eggdrop is on a specific channel. I found "botonchan", but when the eggdrop is not on the channel [botonchan #abc] doesn`t report 0 or -1, but reports an tcl error! This is really crazy, because most people would use botonchan to check if the eggdrop is on that channel, to prevent errors. Is there any other way, to check if the eggdrp is on the given channel?

The only way I can think of, is to make a foreach with all channels, the bot currently is on, and to check if the given channel also is in this list. But this method would be something slower that botonchan.

There`s also a second question, which solution seems very difficult to me:
If a user uses a public command and the argument send to the procedure is a channel, the user often doesn`t know the case sesitive of the channel. In most cases, those user will type the channel lowercase, which is no problem to check, if the eggdrop is on, but what could I do, to answer "Yes, I am on '$channel'!" with $channel is case sensitive like than channel really is named. I only have one idea to solve this, but this seems very unusual to me. Any other suggestions?

Greetings,
ProXy
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Easy solution, use the 'catch' command in tcl.

if {[catch {botonchan $chan} result]} { set result 0 }

# now $result is 0 if bot is not on $chan, 1 if it is
P
ProXy
Op
Posts: 126
Joined: Sun Aug 11, 2002 3:09 pm

Post by ProXy »

Well, thanks for this solution. I will try this to make sure, that the eggdrop really is on the channel, but I guess "botonchan" isn`t very useful, if it produces an error, that must be catched :)

Perhaps this can be improved within the next eggdrop versions...
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: botonchan problems

Post by egghead »

ProXy wrote:Hello,

I simply want to check if my eggdrop is on a specific channel. I found "botonchan", but when the eggdrop is not on the channel [botonchan #abc] doesn`t report 0 or -1, but reports an tcl error! This is really crazy, because most people ...[snip]
To me the response makes great sense. If [botonchan] would report "0" on an "illegal channel", it suggests that the bot has a channel record for that chan or is attempting to join that channel.

What you should have used is [validchan] followed by [botonchan].
P
ProXy
Op
Posts: 126
Joined: Sun Aug 11, 2002 3:09 pm

Post by ProXy »

But -1 for an illegal channel would be better than an tcl error... :)

Thanks for the trick with validchan, this works great..

Well, could anyone also tell me how to get the right case for the channels? :))
Last edited by ProXy on Sat Feb 22, 2003 8:54 am, edited 1 time in total.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Doh! Use what egghead sugested.
Once the game is over, the king and the pawn go back in the same box.
Locked