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.

help with random nicks

Old posts that have not been replied to for several years.
Locked
D
DaveM

Post by DaveM »

I'm attempting to insert a random nick into a randomly chosen list of lines from a channel that a keyword is spoken in.

Code: Select all

bind pubm - * test_msg
proc test_msg {nick uhost hand chan arg} {
   set rano "[rand 4]"
   set randnick [chanlist $chan]
   set words $arg
   set test(0) "hey $randnick don't ever /msg me like that again!"
   set test(1) "$randnick, you really think $randnick should be banned from $chan?"
   set test(2) "I dont think its legal to do that to $randnick"
   set test(3) "$randnick, that's a crazy idea"
   if {[string match "* keyword *" [string tolower $words]]} { putserv "PRIVMSG $chan :$test($rano)" }
}
With this, I'm able to insert _all_ of the nicks in the chanlist, but I can't seem to insert a random nick. I've also tried this:
set randnick [lindex [chanlist $chan] [llength [chanlist $chan]]]
but the output I get is:
<BotNick> , you really think should be banned from $chan?

Can anyone help?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

set people [chanlist $chan]
set randnick [lindex $people [rand [llength $people]]]

baa
D
DaveM

Post by DaveM »

Thanks stdragon! That worked like a charm :smile:

Any ideas how I might be able to set/change the keyword via a /msg to the bot? Currently, I can edit the file manually, but I figured if It could be done via a msg, it would be a little slicker.
Locked