This is a very simple script that i'm sure you can write in no time.
Type /help on text
and the mirc help file will open. There you can see how to use the on text event as you like.
Alternative help:
http://en.wikichip.org/wiki/mirc/on_event#On_Text.2C_Action.2C_and_Notice