Also, marcs-rock, you don't need to repeat the routine for both the event and alias. You can do it with a single one:
on 1:TEXT:!mkpass:#:mkpass
alias mkpass {
$iif($event = text,notice $nick,msg #) ;code to randomize password goes here
}
This will let you have both ways.
Again, I'm still baffled as to why you want to have the alias trigger and send a message to the channel where everybody will be able to see the password being generated.