Conflicting Events
Posted by knightrage
Thursday, January 10, 2008
Description: Learn what conflicting events are and how to fix them.
Events in an mIRC file are 'conflicting' if it is possible for both events to be triggered.
For example, say you have a script that contains _only_ these two events in this order:
[1] on *:JOIN:#:{ }
[2] on *:JOIN:#hello:{ }
These are conflicting because [1] triggers when someone joins any channel, and [2] triggers when someone joins only #hello.
So, what does mIRC do if somebody joins #hello? Joining the channel would match both events for "joining any channel" and "joining channel #hello." Which event will it trigger? Maybe both?
mIRC decides which event to trigger by the location in the script. The event nearest to the top will trigger. Therefore, event [1] will execute.
So, generic events that will trigger regardless of the circumstance should _usually_ reside at the bottom of the script or at least at the bottom of events with the same type:
[3] on *:TEXT:!op*:#: { op user }
[4] on *:TEXT:!voice*:#:{ voice user }
[5] on *:JOIN:#chan1:{ msg user }
[6] on *:JOIN:#:{ notice user }
[7] on *:TEXT:*:#:{ spam filter }
Now, what if you want both events [5] AND [6] to execute? You can combine them like so:
[8] on *:JOIN:#:{ if ($chan == #chan1) { msg user } | notice user }
Or, to make things much simpler, you can just put [5] and [6] in different script files.
Events in an mIRC file are 'conflicting' if it is possible for both events to be triggered.
For example, say you have a script that contains _only_ these two events in this order:
[1] on *:JOIN:#:{ }
[2] on *:JOIN:#hello:{ }
These are conflicting because [1] triggers when someone joins any channel, and [2] triggers when someone joins only #hello.
So, what does mIRC do if somebody joins #hello? Joining the channel would match both events for "joining any channel" and "joining channel #hello." Which event will it trigger? Maybe both?
mIRC decides which event to trigger by the location in the script. The event nearest to the top will trigger. Therefore, event [1] will execute.
So, generic events that will trigger regardless of the circumstance should _usually_ reside at the bottom of the script or at least at the bottom of events with the same type:
[3] on *:TEXT:!op*:#: { op user }
[4] on *:TEXT:!voice*:#:{ voice user }
[5] on *:JOIN:#chan1:{ msg user }
[6] on *:JOIN:#:{ notice user }
[7] on *:TEXT:*:#:{ spam filter }
Now, what if you want both events [5] AND [6] to execute? You can combine them like so:
[8] on *:JOIN:#:{ if ($chan == #chan1) { msg user } | notice user }
Or, to make things much simpler, you can just put [5] and [6] in different script files.