Use /filter or the file handling commands, it'll go leaps faster.
Example:
//filter -ffc quotes.txt tmp *blah* | msg #channel $$read(tmp,nt)
That first filters all lines which contain blah in it to a temp file called "tmp" which is first cleared before written to. Then it messages a random quote from tmp to a channel unless if tmp is empty. You can .remove tmp now or perhaps when exiting mIRC.
Don't blame mIRC for your own shortcomings.