mIRC Home    About    Download    Register    News    Help

Print Thread
Different ON DIALOG Event Methods #185761 13/09/07 04:11 PM
Joined: Sep 2007
Posts: 10
Z
zaqwsxcde Offline OP
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?

Re: Different ON DIALOG Event Methods [Re: zaqwsxcde] #185767 13/09/07 06:03 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
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* }
Re: Different ON DIALOG Event Methods [Re: Lpfix5] #185770 13/09/07 06:20 PM
Joined: Sep 2007
Posts: 10
Z
zaqwsxcde Offline OP
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.

Re: Different ON DIALOG Event Methods [Re: zaqwsxcde] #185773 13/09/07 07:13 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
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.

Re: Different ON DIALOG Event Methods [Re: zaqwsxcde] #185778 13/09/07 09:29 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
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
Re: Different ON DIALOG Event Methods [Re: Riamus2] #185789 14/09/07 12:36 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
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