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.

Random bots

Old posts that have not been replied to for several years.
Locked
k
kem
Voice
Posts: 6
Joined: Sat May 22, 2004 11:25 am

Random bots

Post by kem »

bind pub n !random testk

proc testk {nick uhost hand chan args} {
set ilebotof [lindex [join $args] 0]
set kolek [bots]
set stringi "$kolek"
set miasto "[lindex $stringi $ilebotof]"
putserv "privmsg $chan :Random bots $miasto"
return 1
}
I need tcl when i give !random 5 - bot, give to channel 5 nicks bots (Random search from userlist-linked bots)
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Code: Select all

bind pub n !random show:randombots
proc show:randombots { nick uhost handle channel arg } {
  set limit [lindex $arg 0]
  set bots [chanlist $channel b]
  if {$limit > [expr [llength $bots] + 1]} then {
    set limit [expr [llength $bots] + 1]
  }
  set fbots ""
  set tlimit $limit
  while {$tlimit > 0} {
    set bot [lindex $bots [rand [llength $bots]]]
    if {[lsearch $fbots $bot] == -1} then {    
      lappend fbots $bot
      set tlimit [expr $tlimit - 1]
    }
  }
  if {$fbots != ""} then {
    putserv "PRIVMSG $channel :Random bots on $channel: $fbots"
  } else {
    putserv "PRIVMSG $channel :No bots on $channel"
  }
  return 0
} ;# show:randombots  


I hope it works :)
Locked