mIRC Homepage
Posted By: zaqwsxcde Different ON DIALOG Event Methods - 13/09/07 04:11 PM
I've been scripting mIRC dialogs for a few months now, and have always used separate ON DIALOG events to control the dialog. Recently, I've noticed some people use one ON DIALOG event to control the entire dialog. For example, here's what some ON DIALOG events I use look like:

Code:
on *:dialog:dialog1:init:0: {
  commands
}
on *:dialog:dialog1:sclick:1: {
  commands
}


But I've seen some people use one event for multiple controls:
Code:
on *:dialog:dialog1:*:*: {
  if ($devent == init) {
    commands
  }
  if ($devent == sclick) {
    if ($did == 1) {
      commands
    }
  }
}


Is the this method more efficient? Or is it just a better way to organize your scripts with less events? What method would work best?
Posted By: Lpfix5 Re: Different ON DIALOG Event Methods - 13/09/07 06:03 PM
Originally Posted By: zaqwsxcde
I've been scripting mIRC dialogs for a few months now, and have always used separate ON DIALOG events to control the dialog. Recently, I've noticed some people use one ON DIALOG event to control the entire dialog. For example, here's what some ON DIALOG events I use look like:

Code:
on *:dialog:dialog1:init:0: {
  commands
}
on *:dialog:dialog1:sclick:1: {
  commands
}


But I've seen some people use one event for multiple controls:
Code:
on *:dialog:dialog1:*:*: {
  if ($devent == init) {
    commands
  }
  if ($devent == sclick) {
    if ($did == 1) {
      commands
    }
  }
}


Is the this method more efficient? Or is it just a better way to organize your scripts with less events? What method would work best?


Less confusing for large dialogs, first method. For cleanliness the second. Either or it performs both the same way.
Posted By: zaqwsxcde Re: Different ON DIALOG Event Methods - 13/09/07 06:20 PM
Most the dialogs I build are large, and confusing, and also use MDX, so I think I'll stick with the separate events for each control. It's what I'm most familiar with anyway. I just thought it was worth asking. I didn't know which method performed better, but if they're both the same it doesn't matter. Thanks for the help.
Posted By: SladeKraven Re: Different ON DIALOG Event Methods - 13/09/07 07:13 PM
I'm not entirely sure if the second example would be faster but I'd use that over the first example mainly because I wouldn't want to have 50 or so sclick events. It's all compact into one On Dialog event.

So it could be faster, would probably make sense in a way but as I said I'm not entirely sure. It does make it alot more easier to read through, to me anyway.
Posted By: Riamus2 Re: Different ON DIALOG Event Methods - 13/09/07 09:29 PM
Personally, I prefer to use one on DIALOG per event (init/sclick/edit/etc). I don't separate each ID in the sclick into different sections, but leave them all in a single SCLICK event. But I also don't put the SCLICK and the INIT in the same on DIALOG, either.

I think it's easier to see what's going on if you do that, but that's just my personal preference.
Posted By: genius_at_work Re: Different ON DIALOG Event Methods - 14/09/07 12:36 AM
I usually combine related items into a single event. Such as sclick for several related buttons or checkboxes. Other than that, I usually keep the events separate.

As was mentioned above, there isn't any appreciable difference. It is just preference.

-genius_at_work
© mIRC Discussion Forums