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.

bots share command list

Old posts that have not been replied to for several years.
Locked
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

bots share command list

Post by MeJseL »

Anyone know a script or somthing to make the bot share command help list , like if i type "!commands" and i have 4 bots on .. one bot notice the first command help line then another bot notice the second and then the 3 bot notice the third line and so on .. hope somone can help me with this problem .. i have seen bots that have the same thing but they are not eggdrops.
yeah!
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

you can make it easily following 2 different ways.
1st: each eggdrop bind for the previous command explanation, and tell the next one.
- contraint: you can't easily change the command list.

2nd: a master eggdrop have the list of all commands/explanations and of all eggdrops, and send each bot the command it must explain via botnet.
The receiver just repeat in channel what it receives.
- contraint: due to lag, botnet might be faster than putserv, so the order might be a random one ;)
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

Post by MeJseL »

hehe the second one was that i thought about but i dont realy know how to do that in tcl im use to mirc scripting .. cant u show just a little example ? .. that would be verry nice :lol:
yeah!
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

No, I can't :)
Ok, here's a *complete* example, with a rare thing when I script: some comments :)
The code is in 2 parts, the master on the master egg, the slave on the others eggs.

Code: Select all

# Master script

### SETTINGS
set egglist { "egg1" "egg2" "egg3" "egg4"}
# Masta must be in this list, the better position is first
# nicks in the list are botnet-nick
set comlist {
"command1 is usefull for nothing"
"command2 won't be used"
"command3 is the best for n00b"
"command4 is the last"
}
# that's the array containning all the texts, refer to escape characters to avoid troubles...

### BINDS
bind pub - "!command" list:send
# just a bind :)

### PROCEDURES
proc list:send {nick uhost handle chan arg} {
   global egglist comlist
   set cur_egg 0
   foreach cur_com $comlist {
      if { [lindex cur_egg $egglist] == $botnick } {
         puthelp "PRIVMSG $chan :$cur_com"
      } else {
         putbot [lindex cur_egg $egglist] [concat ">say" $cur_com]
      }
      incr cur_egg
      if { $cur_egg == [llength $com_list] } {
         set cur_egg 0
      }
   }
}

# end of master script

# Slave script

### SETTINGS
set master_egg "egg1"
# The botnet-nick of the sender
set saychan "#yourchan"

### BINDS
bind bot - ">say" list:say

### PROCEDURES
proc list:say { from cmd arg } {
   global saychan master_egg
   if { $from == $master_egg } {
      puthelp "PRIVMSG $saychan :$arg"
   }
}

# end of slave script
It's a simple one, you can improve it with having some feedback from each eggdrops, indicating they have said the sentence.
It could be a security (only one sentence in global queue), but you have enough elements to make the best you need :)
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

Post by MeJseL »

Didnt work :

Code: Select all

Tcl error [list:send]: bad index "aPa": must be integer or end?-integer?
yeah!
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

sorry, I made some mistakes (forgetting some $)

Code: Select all

proc list:send {nick uhost handle chan arg} {
   global egglist comlist
   set cur_egg 0
   foreach cur_com $comlist {
      if { [lindex $cur_egg $egglist] == $botnick } {
         puthelp "PRIVMSG $chan :$cur_com"
      } else {
         putbot [lindex $cur_egg $egglist] [concat ">say" $cur_com]
      }
      incr cur_egg
      if { $cur_egg == [llength $com_list] } {
         set cur_egg 0
      }
   }
} 
replace the procedure with this one :)
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

Post by MeJseL »

Same error ^^ :

Code: Select all

Tcl error [list:send]: bad index "apa": must be integer or end?-integer?
yeah!
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Yes, I understand :)
I'd inverted arguments in lindex command, this is now tested :)

Code: Select all

proc list:send {nick uhost handle chan arg} {
   global egglist comlist botnick
   set cur_egg 0
   foreach cur_com $comlist {
      if { [lindex $egglist $cur_egg] == $botnick } {
         puthelp "PRIVMSG $chan :$cur_com"
      } else {
         putbot [lindex $egglist $cur_egg] [concat ">say" $cur_com]
      }
      incr cur_egg
      if { $cur_egg == [llength $comlist] } {
         set cur_egg 0
      }
   }
} 
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

Post by MeJseL »

It worked thx a lot
yeah!
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

Post by MeJseL »

but hmm i have more then 4 lines in the command list and the bot only msg 4 of them :| .. how do i make them msg all commands like 10 lines ?
and how about notice nick insted of msg chan ? .. i know thats a lot of thing and im a pain in the ass but it would been so nice if u could help me :)
yeah!
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

you can put all the lines you want...
each line is read and sent to the good eggdrop, with cycling them.

Code: Select all

incr cur_egg
if { $cur_egg == [llength $com_list] } {
set cur_egg 0 
This is the way to cycle: if we are further than the items number (ie the number of eggs), we restart from 0

And to use notice, it's a little more difficult: you must send the recipient'nick to each egg, and each egg must split the line...
so, it could be like this:
### MASTA script

Code: Select all

putbot [lindex $egglist $cur_egg] [concat ">say" $cur_com]
becomes:
putbot [lindex $egglist $cur_egg] [concat ">say $nick" $cur_com]
and
puthelp "PRIVMSG $chan :$cur_com"
becomes
puthelp "NOTICE $nick :$cur_com"
### SLAVE script

Code: Select all

proc list:say { from cmd arg } {
   global saychan master_egg
   if { $from == $master_egg } {
      puthelp "PRIVMSG $saychan :$arg"
   }
} 

becomes

proc list:say { from cmd arg } {
   global saychan master_egg
   set nick [lindex $arg 0]
   set text [lrange $arg 1 end]
   if { $from == $master_egg } {
      puthelp "NOTICE $nick :$text"
   }
} 
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

Post by MeJseL »

thx man ur the best :)
yeah!
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

MeJseL wrote:thx man ur the best :)
don't say that to me, I allready know :)
just say that to anybody you meet :)
M
MeJseL
Halfop
Posts: 61
Joined: Tue Nov 18, 2003 7:30 am
Location: Gothenburg , sweden

Post by MeJseL »

hehe :mrgreen:
yeah!
Locked