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 

Weird bot problem

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


Joined: 14 Nov 2005
Posts: 47
Location: Netherlands

PostPosted: Thu Jan 05, 2006 11:04 am    Post subject: Weird bot problem Reply with quote

Hi guys/girls,

I have the following script:
Code:
proc msg:join {nick host hand text} {
  set chan [lindex $text 0]
  if {[botonchan $chan]} {
    putquick "NOTICE $nick :I am allready on \002$chan\002"
    return 1
  }else{
    putquick "PRIVMSG #bots :I have been invited into \002$chan\002 by \002$nick\002"
    putquick "NOTICE $nick :You invited me to join \002$chan\002. Joining..."
    channel add $chan
  }
}


The weird thing is, that it worked 1 time, after that it didn't work anymore.
What am I doing wrong? Because when I start the bot, it doesn't give any errors.
The problem accured when I added the ... if {[botonchan $chan]} { line ...

Thanks in advance!
_________________
is-1337.org IRC server!
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Jan 05, 2006 1:19 pm    Post subject: Reply with quote

You got an error after adding that line but didn't bother to show it here. Replace
Code:
}else{

with
Code:
} else {

or just
Code:
} {

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
T-Xorcist
Halfop


Joined: 14 Nov 2005
Posts: 47
Location: Netherlands

PostPosted: Thu Jan 05, 2006 11:44 pm    Post subject: Reply with quote

Tried it. After I restart the bot, it lissens to me 1 time (parting the channel). After that, it seems it crashes :S

I really do not get the problem Crying or Very sad

UPDATE: It doesn't even connect to the IRC server right now... This is a very weird problem I guess... This happened why I tried the } { thing Wink
_________________
is-1337.org IRC server!
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jan 06, 2006 9:13 am    Post subject: Reply with quote

Is that even a problem from the script? What do you mean crashes? any errors?

Also, I recommend you to split text when setting chan.
Code:
set chan [lindex [split $text] 0]

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
T-Xorcist
Halfop


Joined: 14 Nov 2005
Posts: 47
Location: Netherlands

PostPosted: Fri Jan 06, 2006 12:47 pm    Post subject: Reply with quote

Well, it doesn't work as it supposed to.

When I type /msg botnick join #channel it doesn't respond at all.
But if I use a channel where it is allready in, it gives me response that he is allready in that channel.

So, if the bot is in the channel, it responds with: I am allready in #channel.
But if he is not, he doesn't give me response and doesn't join the channel.

Exactly the same problem with the parting area. It parts the channel if he is on that channel. But if he is NOT on the channel, it doesn't give me a response. After the else, it is going wrong. I guess he doesn't like the } else { part Sad

For better understanding, here is the whole script:

Code:
bind msg - join msg:join
bind msg m part msg:part


proc msg:join {nick host hand text} {
  set chan [lindex [split $text] 0]
  if {[botonchan $chan]} {
    putquick "NOTICE $nick :I am allready on \002$chan\002"
  } else {
    putquick "NOTICE $nick :You invited me to join \002$chan\002. Joining..."
    channel add $chan
  }
}

proc msg:part {nick host hand text} {
  set chan [lindex [split $text] 0]
  if {[botonchan $chan]} {
    putquick "PRIVMSG $chan :Leaving channel... (Removed by T-Xorcist)"
    channel remove $chan
  } else {
    putquick "NOTICE $nick :I am not on \002$chan\002"
  }
}

_________________
is-1337.org IRC server!
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jan 06, 2006 1:01 pm    Post subject: Reply with quote

That's because it's not a validchan (doesn't exist in bot's chanfile).
Code:
bind msg - join msg:join
bind msg - part msg:part

proc msg:join {nick uhost hand arg} {
 set c [lindex [split $arg] 0]
 if {[validchan $c]} {
  puthelp "notice $nick :$c is already in my chanfile."
 } {
  channel add $c
  puthelp "notice $nick :$c has been succesfully added to my chanfile."
 }
}

proc msg:part {nick uhost hand arg} {
 set c [lindex [split $arg] 0]
 if {[validchan $c]} {
  channel remove $c
  puthelp "notice $nick :$c has been succesfully removed from my chanfile."
 } {
  puthelp "notice $nick :$c does not exist in my chanfile."
 }
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
T-Xorcist
Halfop


Joined: 14 Nov 2005
Posts: 47
Location: Netherlands

PostPosted: Fri Jan 06, 2006 1:09 pm    Post subject: Reply with quote

Great! It works now. Very much appreciated! Razz
_________________
is-1337.org IRC server!
Back to top
View user's profile Send private message Visit poster's website
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