mIRC Homepage
Posted By: DrkShadow event execution order/halts - 27/06/03 03:05 AM
(events included below for reference)

the intent: An event, coming in a later file, is supposed to determine if a notice needs to be ignored. If it is, it's to halt the script, relying on the other event's & prefix to determine if the next event should print it out.

the problem: The first event (with an & prefix) executes before the event to determine if it should be ignored. The output is:
Code:
Halted is: false
Notice ignored

which is contrary to what I want. The scripts seem to be executing out of order. I don't really think there's any fix for the order, but could someone suggest a fix for my situation?

why I can't use ifs: The thing about the fix most are immediately thinking about (combining the events and using if statements) is that they _have_ to be in two separate files. The second file is a script which will eventually be distributed (the event provided is for reproducing behavior -- though I do currently have that overall halt in there ;-) while the first is my personal scripts, which I'm keeping to myself. If anyone else that would end up using the script had a script such as I do, the feature wouldn't work for them. They can't be combine because it would be too great a burden, imo, and anyone else that's using something like IRCn or some other such script wouldn't likely know how, or even where, to edit.

the fix: While I can understand this being easier on the author, I don't believe this order should be the case. The & prefix makes the script depend on other events being executed first -- if the & event executes first, what's to keep it from ever executing? So, I suggest making & events execute only after other events (without the &). This would give all other events that will execute anyway a chance to prevent the & event from being executed. As for the order of these events... well, it can't really be established any other way than the order in the files that is used now, or a future added order property.. but lets not get into that (it'd be badly used anyway). So, how 'bout it, Mr. Mardam-bey? Think you could program it in such a way as to execute & events last? ;-)

But my plea: anyone have any idea how I can get this to work as desired? I've tried all I can think of. an on &*:notice event will display the default notice (the blue thing in whatever window is active), tried an on ^*:notice to haltdef always, expecting the on *:notice to hit, but the on *:notice then doesn't work, on * will execute halted or not, but then you don't know if it was haltdef'd to prevent the default notice or if it was halted as a block. *sigh* I'm open to suggestions.

file: interface.mrc:
Code:
on &^*:Notice:*:?:{
  echo -s Halted is: $iif($halted,true,false)
  if ($window(@Notice- $+ $network) == $null) {
    window -enk[1] @Notice- $+ $network 
  }
  echo -t @notice- $+ $network $chr(91) $+ $nick $+ $chr(93) $1-
  haltdef
}


file: sCript.mrc:
Code:
on !^*:NOTICE:*:?: {
  echo -s Notice ignored.
  halt
} 
Posted By: Collective Re: event execution order/halts - 27/06/03 03:17 AM
Events trigger in the order of the files they are in. If you have a list of files like this:
1. script1.mrc
2. script2.mrc
then the events in script1.mrc will trigger before the events in script2.mrc. Assuming you have the files loaded in the same order as you gave them then that is your problem, they should be the other way around. To change the order script files are in goto File -> Order... in the mIRC Editor.
Posted By: DrkShadow Re: event execution order/halts - 27/06/03 03:34 AM
I must say, you completely ignored the fact that I said I was distributing the script. It's not going to be going to many people that can greatly modify their mirc, and possibly those without a clue even of how to open the remotes.

That said, I was willing to have a method of reordering scriptually. If I could do it on a load event or something, that'd be fine. However, I didn't know of one. For those interested, reload -rs1 $script will put it in the first position, making its events execute first.

one more step towards "Type this command, it'll download and install itself automagically." :-)

-DrkShadow
Posted By: Collective Re: event execution order/halts - 27/06/03 03:39 AM
And I must say you're a twat, you asked for a fix, I gave you one, if you have a better one, good for you. I'm not payed to help you know.
Posted By: Thray Re: event execution order/halts - 27/06/03 05:14 AM
If you were, would you be more polite? Sometimes when I call tech support people I can almost FEEL them holding back a scream along the lines of "READ THE MANUAL YOU JERK."

I probably deserve it since half my problems are made up so I can piss them off. Hey, I'd be glad of callers and such to keep me from getting bored. `sides, its what HP and Linksys get for having products that aren't flawless.
Posted By: Collective Re: event execution order/halts - 27/06/03 05:22 AM
Quote:
If you were, would you be more polite?

Yes, because otherwise I'd probably be fired..
Posted By: Thray Re: event execution order/halts - 27/06/03 05:23 AM
But your coworkers would love you.
© mIRC Discussion Forums