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 

Need some help with this join script

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


Joined: 06 Dec 2008
Posts: 30

PostPosted: Wed Dec 17, 2008 12:13 pm    Post subject: Need some help with this join script Reply with quote

Hi there,
I started on a join script, and was wondering about how I should write the "if {ChanServ JOIN}".
Code:
bind msg - ?join join_proc

proc join_proc { nick chan arg }
   if {ChanServ ison $chan} {
      putquick "PRIVMSG $nick :ChanServ ison chan!"
   } else {
      putserv "JOIN $chan"
   }
   if {ChanServ JOINS} {
      putquick "PRIVMSG $chan :ChanServ joined!"
      putserv "PART $chan"
   }
}
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Dec 17, 2008 4:39 pm    Post subject: Reply with quote

Code:
if {[string equal -nocase "chanserv" $nick]} {
 # $nick is ChanServ
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
JKM
Voice


Joined: 06 Dec 2008
Posts: 30

PostPosted: Wed Dec 17, 2008 7:26 pm    Post subject: Reply with quote

So..
Code:
proc join_proc { nick chan arg }
   if {ChanServ ison $chan} {
      putquick "PRIVMSG $nick :ChanServ ison chan!"
   } else {
      putserv "JOIN $chan"
   }
   if {[string equal -nocase "chanserv" $nick]} {
      # $nick is ChanServ
      putquick "PRIVMSG $chan :ChanServ joined!"
      putserv "PART $chan"
   }
}
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Dec 17, 2008 7:39 pm    Post subject: Reply with quote

You want your bot to check if ChanServ is in the channel when the bot joins?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Dec 29, 2008 6:54 am    Post subject: Reply with quote

For the {Chanserv JOINS} test, use the code suggested by Sir_Fz.

For the {ChanServ ison $chan} test, use this:
Code:
if {[onchan ChanServ $chan} {


Further; this will not produce the desired result:
Code:
putserv "JOIN $chan"

This will only cause your eggdrop to join the channel, only to get confused and leave it instantly; use the channel add command instead.
Same goes for this:
Code:
putserv "PART $chan"

Use channel remove instead.

Finally, your argument-list does not match the kind of binding you're using, msg bindings calls the proc with the following parameters, nick host handle text.
It should be something like this:
Code:
proc join_proc {nick host handle text} {


Finally, I don't see chan defined anywhere whithin your proc. Were you thinking of taking whatever is written after ?join as the channel-name?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Dec 29, 2008 8:32 am    Post subject: Reply with quote

The problem with using [onchan] here is that the bot won't have the chanlist generated yet when it first joins. So [onchan] will return 0 even if ChanServ is actually in the channel. One solution would be to delay the check for a few seconds...
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
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