Note: The mainteinance of the scripting examples is discontinued since I no longer have an interest to continue doing so. The pages will remain here, for now, but that might not be the case in the future. You are free to download all the material on these pages and set a up mirror, or even continue the maintenance of the material by enhancing the examples yourself.

All the material in these examples are for the mIRC version 6.03. It is very likely that some or most of these examples won't work in future versions.

Ignoring a word or a phrase

Sometimes people wonder why mIRC has no ignore functions to ignore lines that contain specific words or phrases. The reason for this is rather simple. mIRC already has a flexible scripting language which allows you to do more complex ignores than any built-in command could ever do. The key is to understand on TEXT event and the way the mIRC interprets the remote event definition. The first line of on TEXT event should always be something like
on <prefix><level>:TEXT:<matchtext>:<channels><?><*>: <commands>

To understand the event prefixes and access levels, you should see '/help Access levels'. The most common access level is * which matches for everyone. The matchtext field is where you can put the words and phrases. You can use wildcards. For example *foo* would match for every line which has the string 'foo' in it. *foo would match any line that ends to foo and foo* would match any line that starts with foo. See the wildcard page for more detailed examples. The last field is where you can specify what message targets the event is triggered for. # means that it's triggered for all channel messages, ? for all private messages, and * for all private and channel messages. You can also put channel names there, like #chat or groups of multiple channels, like #chat,#idle,#stars.

The way to halt the text from being shown is use ^ as the event prefix and use haltdef command in the event commands. This syntax can be used with most of the other events as well. If you want to ignore all messages with a specific phrase, you probably want to halt on ACTION and on NOTICE events as well. If you want to filter server notices, you can use on SNOTICE.

Keep in mind that simply halting on TEXT event won't stop new private windows from opening. To accomplish that, you need to halt the on OPEN event. If you decide to ignore private messages with simple wildcard matches, I suggest that you send a notice to the user who got ignored. You should naturally keep in mind that actual notices should never be replied to. The purpose of notice is to provide automations a way to send messages while avoiding endless loops. Note that on OPEN event won't be triggered for the query windows you open yourself. This means that you can always send private messages to people even if you had on OPEN event that would ignore all queries. You can also receive the messages after you have opened the query window.

I must say a few words of warning when scripting ignores based on words. You should remember that these scripts are very elemental and stupid. They can't be used to filter out uninteresting topics of discussion or to filter out all spam. The word ignores are best for lines that follow exact syntax. For example many channels have a bots that respond to triggers, like !top10 or !quote. It's easy to ignore the bots but if you want to ignore everyone issuing these commands, then word ignores are very nice tool. In this case the word ignores allow you to view all channel communication normally while still ignoring all bot triggers.

Example script

; Ignore all !quote commands on #chat
on ^*:TEXT:!quote:#chat: haltdef

; Ignore all lines with the word foo in all channels
on ^*:TEXT:*foo*:#: haltdef
on ^*:ACTION:*foo*:#: haltdef

; Ignore all new query windows with 'http' and 'www' (a simple spam protection)
on ^*:OPEN:?:*http*: {
  ; Send a notice with the reason for ignoring
  notice $nick Private message ignored because of suspected spam
  ; Ignore new private messages from the host for the next 5 seconds to
  ; prevent mIRC from sending too many notices
  .ignore -pu5 $wildsite

on ^*:OPEN:?:*www*: {
  notice $nick Private message ignored because of suspected spam
  .ignore -pu5 $wildsite

; Ignore all server notices that match *kill*ghost*
on ^*:SNOTICE:*kill*ghost*: halt

Last updated 2003-04-05, Janne 'Geetee' Nikula,