mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2007
Posts: 10
Z
Pikka bird
OP Offline
Pikka bird
Z
Joined: Sep 2007
Posts: 10
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?

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
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.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Sep 2007
Posts: 10
Z
Pikka bird
OP Offline
Pikka bird
Z
Joined: Sep 2007
Posts: 10
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.

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
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.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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


Link Copied to Clipboard