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.

bots detects itself that it joined a chan

Old posts that have not been replied to for several years.
Locked
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

bots detects itself that it joined a chan

Post by z_one »

Here's my code ... I need the bot to know that it is the one who joined a channel. I only want it to react when it is the one that joins ... not any other nick.
What wrong with that code ?
By the way, <my_nick_here> would be my nick on irc of course.

Code: Select all

bind join - * botjoined

proc botjoined {nick uhost hand chan} {
  global botnick

    if {$nick == $botnick} { 
       putserv "PRIVMSG <my_nick_here> : I joined $chan"
   }
}
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: bots detects itself that it joined a chan

Post by egghead »

z_one wrote:...[snip]...
What wrong with that code ?
...[snip]...
What problem/error do you get? :-?
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Puthelp coding

Post by spyda »

puthelp <text> [options]
Description: sends text to the server, like 'putserv', but it uses a
different queue intended for sending messages to channels or people.
Options: -next: push messages to the front of the queue
Returns: nothing
Module: server
It works on the fashion of puthelp "PRIVMSG $nick :$what"

Code: Select all

bind join - * botjoined 

proc botjoined {nick uhost hand chan} { 
 global botnick 
 if {$nick == $botnick} { 
  puthelp "PRIVMSG $botnick :I joined $chan" 
 } 
} 
Hope that Helps
------------
ThePope
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

There is no error message.
I just don't get any private message from the bot itself although I make sure to specify my nick as the one to receive the message when the bot joins the channel.

It's as if the code wasn't entering that IF condition.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

One of the most important skills you can have as a programmer is to learn how to find errors.

You find errors by adding debugging information in key places. The most common form of debugging with Eggdrop is using the "putlog" command. What you need to do is add putlog statements to various parts of the code so that you can trace what is happening.

For instance, add a putlog at the top of the botjoined proc that prints out the $nick that joined. Then add one inside the "if" statement. Eventually you will find out where the error is happening.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

z_one wrote:There is no error message.
I just don't get any private message from the bot itself although I make sure to specify my nick as the one to receive the message when the bot joins the channel.

It's as if the code wasn't entering that IF condition.
In addition to the comments of stdragon, make sure you enter the putserv line correctly:

Code: Select all

putserv "PRIVMSG z_one :I joined $chan"

i.e.

putserv "PRIVMSG<space>z_one<space>:I joined $chan"

NOT VALID:

putserv "PRIVMSG z_one: I joined $chan"

(i.e. omitting the second <space> is not valid.)
Locked