Plugin triggers called before Client triggers = problem..

Posted by Trevize on Sun 06 Dec 2009 02:18 PM — 4 posts, 19,546 views.

#0
Alright, so I have two trigger that goes through on this "Many golden sovereigns spill from the corpse." for example. One is within a plugin, the other in mushclient own triggers.

The problem I'm having is that the plugin trigger is -always- called first even though it's sequence is higher then the one in mushclient. I'm guessing sequences in mushclient and plugins dont work with each other?

Is there any easy fix for this? I dont want stuff like "DoAfterSpecial (0.1, "get gold", 12)" fixes. I was more hoping for a hidden button in mushclients settings that makes it trigger mushclient before plugins^^

Thanks.


Netherlands #1
I have in the past requested that triggers get executed in the order of their sequence regardless of their plugins, which Nick wasn't in favor of due to me being the only one to run into this issue. The only workaround (in the case of two different plugins) is to load the one that needs to execute its triggers first, LAST. (If I recall properly, anyway.)

I guess you could hack around the issue with CallPlugin but that'd create dependancies etc. Sadly, there is no good fix.
Amended on Sun 06 Dec 2009 03:42 PM by Worstje
Australia Forum Administrator #2
Plugins are supposed to be independent. If the order of execution matters, then they aren't independent. And if you make it so you can change the order, and someone wants A to be run before B, and someone else wants B to be run before A then it won't work.

It is easy to turn the internal trigger into a plugin, the plugin wizard does that for you, but you still have the issue of the order.

If it isn't a huge problem, you can put that trigger into the plugin with the other trigger, then the sequence number will be honoured.
Netherlands #3
The fact you want to have one plugin execute a certain trigger after another isn't a matter of it being independant. The two can run seperately just fine. :)

The problem is in pacifying the two entities so they will not clash. Prompt triggers are the most famous example I believe (one plugin to replace it with a custom prompt), another to get a specific detail out of a prompt, and yet another which uses it for a EOF marker. Depending on the exact implementations, these triggers can very much block eachother and make getting multiple plugins to work side-by-side a pain.

I always thought the merging was a nice solution, together with some kind of guideline for proper sequence numbers.

0-50: High priority. Use for preventing the execution of other triggers on this line (Keep Evaluating flag). Never omits from output.
50-100: High priority with omittance. (Some plugins use GetLineInfo etc, and deleting lines, omitting etc can cause surprising effects; that's experience talking...)
100-150: Medium priority: for all casual run of the mill triggers.
150-200: Low priority: for stuff you want executed as a very last resort.

It could probably be made a bit more fine with eye for other potential conflicts amongst triggers in different plugins, but that's a basic idea anyway.