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.

putallbots

Old posts that have not been replied to for several years.
Locked
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

putallbots

Post by kain »

Hey,
Can someone give me a simple example
of 'puallbots' and 'bind bot'
I've been fiddling with it for a while and can't
get it to work. All I need to carry over is $nick
and maybe $hand, just never works for me though.
Thanks in advance.
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

putallbots <message>
Description: sends a message across the botnet to all bots. If no script intercepts the message on the other end, the message is ignored.

bind bot <flags> <command> <proc>
proc-name <from-bot> <command> <text>
Description: triggered by a message coming from another bot in the botnet. The first word is the command and the rest becomes the text argument; flags are ignored.
So, if you want to send $nick and $hand:

Code: Select all

# masta bot
proc your:proc {nick hand} {
set msg "saw $nick $hand"
putallbots $msg
}

################
# slaves bots
bind bot - saw proc:saw
proc:saw {from command args} {
   global masta_nick mychan
   if {$from == $masta_nick} {
      set unick [lindex $args 0]
      set uhand [lindex $args 1]
      putquick "PRIVMSG $mychan :$masta_nick saw $unick, known as $uhand"
   }
}
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

This putallbots proc would be on each bot,
so is there any way to broadcast it to all bots
rather than a single bot, I thought putbot was for a single
and putallbots would send the command to all bots?
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

Ok, still can't get it working
heres the code im trying to work with
basically it sends 'ninvite $n' over the botnet and then
gets caught by all the other bots then calls the 'inviteall' proc
which works on its own btw, just not like this.

Code: Select all

proc myproc { n u h a } {
code...
set netinvite "ainvite $n $h"
putallbots $netinvite
}

# botnet invite
bind bot - ainvite ninvite
proc ninvite {from command args} {
set n [lindex $args 0]
set h [lindex $args 1]
inviteall $n $h
}

# auth invite
proc inviteall { n h args } {
  set clist ""
  foreach c [channels] {
    if {[matchattr $h -|I $c] && [botisop $c] && [string match *+private* [channel info $c]]} {
      putserv "INVITE $n $c"
      lappend clist $c
    }
  }
  return 0
}
Like I said, the inviteall proc works fine, just doesnt work when sent over
the botnet.
Last edited by kain on Tue Oct 14, 2003 1:45 pm, edited 1 time in total.
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

kain wrote: inviteall $n $h
proc inviteall { n h args } {
Don't think you forget to send args?
if you don't need it, don't put it.
End if you're not sure you'll use it, try:

Code: Select all

proc inviteall { n h {args ""}} {
and a small advice: use intelligent-named variables, prefer $nick than $n...
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Larger advice, your BOT bind proc is accepting $args which is a special variable.
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

Removed the '$args' and now I get:
Tcl error [ninvite]: called "ninvite" with too many arguments
I've tried changing a few things but nothing seems to work.
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

This code on a single bot works, but when called with the putallbots
it doesn't

Code: Select all

# auth invite
proc inviteall { n h c } {
  set clist ""
  foreach c [channels] {
    if {[matchattr $h -|I $c] && [botisop $c] && [string match *+private* [channel info $c]]} {
      putserv "INVITE $n $c"
      lappend clist $c
    }
  }
  return 0
}
Called with "inviteall $n $h"
Locked