# names.irc, a clone of the linux command "names" by Saint Toad. 
# Generates a random name using a list of words in $dictionary
# Also the namef() function so it can be used in scripts

# Specify the dictionary file
@ dictionary = [ /usr/dict/words ]

alias capitolf {
^assign function_return $toupper($left(1 $0))$tolower($mid(1 256 $0))
}

alias name {
 if ([$0]) {
 eval @ namenum = $0
 @ namecount = 0
 while ( namenum > namecount ) {
  say $namef()
  @ namecount++ 
 }
 }{
  say $namef()
 }
}

alias randletter {
 eval @ randcharnumb = rand(26) + 65
 ^assign function_return $chr($randcharnumb)
}

alias namef {
 eval @ randcharnumb = rand(26) + 65
 eval ^assign function_return $capitolf($randread($DICTIONARY)) $randletter(). $capitolf($randread($DICTIONARY))
}

xecho -banner names.irc is now loaded. /name to use. /name <num> to say more then one name