Originally Posted By: Wolfie
Actually that's bad advice. Multiple event handlers means extra parsing and the idea is to reduce code as well.


It is faster/better to narrow down the event handler as I explained than to have a single event handling multiple triggers. The reason is if you have a single "catch-all" event the handler will still trigger for EVERY received message leaving the scripted body to narrow down when the script should activate. Where as multiple event handlers make use of mIRC's internals to avoid needless scripted(I.g. slow) handling.


Assuming we receive the following messages from users in a channel
Code:
<john> Hi, anyone around?
<bill> Hello, ask your question
<@tim> !example1
<john> this is example inputs
<@George> !example2


The following will trigger 5 times even though its only needed twice:
Code:
on *:TEXT:*:#:{
  if ($nick isop #)
    if ($1- == !example1) {
      stuff
    }
    elseif ($1- == !example2) {
      stuff
    }
  }
}



Verses the following where each event will only trigger once
Code:
on *:TEXT:!example1:#:{
  if ($nick isop #) {
    stuff  
  }
}

on *:TEXT:!example2:#:{
  if ($nick isop #) {
    stuff
  }
}


Last edited by FroggieDaFrog; 13/12/15 07:42 AM.