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 

requestbot script (wont scan channels)

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


Joined: 08 Apr 2007
Posts: 10

PostPosted: Thu Apr 12, 2007 3:11 pm    Post subject: requestbot script (wont scan channels) Reply with quote

egg will join the channel if X ops from #channel is on the master channel.
i cant get it to join a channel :/

it locks up on "foreach" as i dont get any notice from it
help? Razz

this is what i've got:
Code:
# set your master channel that those requesting the bot has to be in #
set masterchan "#prassel"

# set message when no matches have been announced #
set nomatch "No matches announced at this moment"

# requirements (how many ops from servicechannel in the masterchannel) #
set chanusreq 1

# message to send back when a channel does not meet the requirements to get the bot #
set nochanreq "Your channel does not meet the requirements"

# message to notice user when successfully joined #
set chanjoinmsg "Joined $reqchan"

bind msg n|m|o "requestbot" chan:check
proc chan:check {nick chan} {
   set authusers 0
   set reqchan [lindex $text 0]
   foreach nick [chanlist $reqchan] {
      if {([isop $nick $reqchan] == 1) && ([onchan $nick $masterchan] == 1)} {
         incr authusers
      }
   }
   if {$authusers < $chanusreq} {
      putserv "NOTICE $nick :$nochanreq"
   }
   elseif {$authusers >= $chanusreq} {
      channel add $reqchan
      putserv "NOTICE $nick :$chanjoinmsg"
   }
}
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Apr 12, 2007 3:24 pm    Post subject: Reply with quote

First off, the number of arguments in your proc does not match the number of arguments used when the binding triggers (see doc/tcl-commands.doc).

Secondly, the variable "text" is not defined before it is used inside the same proc.

Third, you try to use some of the variabled you've defined in globalspace (outside the proc) from within the proc, using local namespace rather than the global (either access them using the "global" command, or use absolute addressing, ie $::nochanreq instead of $nochanreq

Fourth, chanlist will only operate on channels already added to your bot, so you cannot use it in this way (there is also a slight delay from when the channel is added, until your bot has actually joined it and gathered data on who's in the channel. During this time, chanlist will return an empty list).
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
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