if you (in mirc) do /help on text
it will give you help for how to do what you want.
Also, and most of the scripting sites (google search for 'mIRC Script' you can find a lot of example on how to catch words or pharases with on text. Most are for bad word scripts, but the logic for checking works, and the command you use (in your case /ignore $nick ) would work with them.
Good luck!