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 characters

Old posts that have not been replied to for several years.
Locked
P
Promethean

Post by Promethean »

I am using eggdrop 1.6.4 (I know I know),

I am new to tcl (this is my first attempt), and I am trying to get the bot to respond with an action on text in the channel

I have the bind in place and everything works, but now I would like to respond with random characters. Random alhpanumerics at least 10 characters in length.

Is this possible?

Thanks in advance
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Somthing like this should do it

proc randchar {len} {
set t ""
set alphanum "ABCDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmopqrstuvwxyz01234567890"
while {[string length $t] < $len} {
append t [string index $alphanum [rand [string length $alphanum]]]
}
return $t
}
Then in your script, while outputting, use
putserv "PRIVMSG nick :random [randchar 10]"
Locked