on *:text:!random &:#: {
if ($nick !isop $chan) { .notice $nick Only ops can use this command. | return }
if ($2 !isnum 1-4) { msg $chan Invalid format: Use !random 1, !random 2, !random 3, or !random 4 | return }
var %cnt = 1
while (%cnt <= $2) {
while ($istok(%words,%word,32) || %word == $null) {
var %word = $read(words.txt)
}
var %words = %words %word
var %num = $iif(%cnt = 1,First,$iif(%cnt = 2,Second,$iif(%cnt = 3,Third,$iif(%cnt = 4,Fourth))))
msg $chan %num random word is %word
inc %cnt
}
}