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 

REALLY SIMPLE - I'm having a block and am tired.

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


Joined: 17 Oct 2006
Posts: 22

PostPosted: Sat Jul 14, 2007 8:51 am    Post subject: REALLY SIMPLE - I'm having a block and am tired. Reply with quote

Well, the idea is when the bot is invited to a channel it joins but if the user amount in the channel is lower than 3 it will part.

I just can't think of how to get the number of people in the channel.

Thank you in advance.
Back to top
View user's profile Send private message
scarface
Voice


Joined: 11 Jul 2005
Posts: 12

PostPosted: Sat Jul 14, 2007 9:13 am    Post subject: Reply with quote

well, its [llength [chanlist #channel]]
but since the bot joins u should do this check after recieving the nicklist on the channel (bind raw) dont remember the raw atm. if you just use a bind join proc for it, the bot havent recieved the chanlist, and it will return 1.
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Sat Jul 14, 2007 12:46 pm    Post subject: Reply with quote

you want the end-of-who raw, which is raw 315.

http://www.xs4all.nl/~wiebeson/rawlist.txt is a list of raws.
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Sat Jul 14, 2007 2:52 pm    Post subject: Reply with quote

Well you will need to use bind raw with the keyword "INVITE". You will also need an additional bind join, for the bot to check on join the channel user count and then based on that either part or stay in the channel.

Here is a basic script which can do the work for you, make changes and edit it yourself the way you would want it to work accordingly.

Code:

bind raw - INVITE invite:detector
bind join - "*" check:chan:count

proc invite:detector {from keyword arg} {
 channel add [string tolower [lindex [split [join $arg ""] :] 1]]
}

proc check:chan:count {nick uhost hand chan} {
 if {[isbotnick $nick]} {
  if {[llength [chanlist $chan]] < 3} {
    channel remove $chan
    }
  }
}

_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Sat Jul 14, 2007 3:18 pm    Post subject: Reply with quote

awyeah its best to bind on raw 315 (end of who) so then the bot would of got the list.

Code:
bind raw - INVITE invite:detector
bind raw - 315 check:chan:count

proc invite:detector {from keyword arg} {
 global invite
 if {[validchan [string tolower [lindex [split [join $arg ""] :] 1]]]} { return }
 set invite([string tolower [lindex [split [join $arg ""] :] 1]])
 channel add [string tolower [lindex [split [join $arg ""] :] 1]]
}

proc check:chan:count {from keyword arg} {
 global invite
 if {![info exists invite([set chan [string tolower [lindex [split $arg] 1]]])]} {
  unset $invite($chan)
  if {[llength [chanlist $chan]] < 3} {
   channel remove $chan
  }
 }
}


Just a few tweaks to awyeah's code.
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Jul 14, 2007 5:19 pm    Post subject: Reply with quote

I see that you are using '[string tolower [lindex [split [join $arg ""] :] 1]]' 3 times. Why haven't you done the same thing like in 'if {![info exists invite([set chan [string tolower [lindex [split $arg] 1]]])]} {' ? Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Jul 15, 2007 9:40 am    Post subject: Reply with quote

Do not apply join over a string.
_________________
Follow me on GitHub

- Opposing

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


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Mon Jul 16, 2007 3:41 am    Post subject: Reply with quote

Why shouldn't we apply join over a string? join is used in relation with strings. I don't understand this, please elaborate Sir_Fz.

Anyway Tossers, could would work, but as caesar mentioned to make it more understandable and readable easier to the eye, you can use this:

Code:

bind raw - INVITE invite:detector
bind raw - 315 check:chan:count

proc invite:detector {from keyword arg} {
 global invite
 set chan [lindex [split [join [string tolower $arg] ""] :] 1]
 if {[validchan $chan]} { return 0 }
 set invite($chan) 1
 channel add $chan
}

proc check:chan:count {from keyword arg} {
 global invite
 set chan [string tolower [lindex [split $arg] 1]]
 if {[info exists invite($chan)]} {
  if {[llength [chanlist $chan]] < 3} {
   channel remove $chan
   unset invite($chan)
  } else {
   unset invite($chan)
  }
 }
}

_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Zorb
Voice


Joined: 17 Oct 2006
Posts: 22

PostPosted: Mon Jul 16, 2007 4:40 am    Post subject: Reply with quote

Okay well, everything works well but when someone parts the channel I need it to check the users again.

So what's the bind for when someone parts the channel?
Back to top
View user's profile Send private message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Mon Jul 16, 2007 4:43 am    Post subject: Reply with quote

Quote:

bind part <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <msg>

Description: triggered by someone leaving the channel. The mask is matched against "#channel nick!user@host" and can contain wildcards. If no part message is specified, msg will be set to "".

New Tcl procs should be declared as

proc partproc {nick uhost hand chan {msg ""}} { ... }

for compatibility.

Module: irc


Something like this:

Code:

bind part - "*" check:users:on:part

proc check:users:on:part {nick uhost hand chan {text ""}} {
 if {![isbotnick $nick]} {
  #whatever you want to do here
  }
}

_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Jul 16, 2007 6:37 am    Post subject: Reply with quote

Basically, [join] converts lists into strings. Check the join manual page.
_________________
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