Unexpected Trigger Fire

Post Reply
zhenzh
Posts: 68
Joined: Fri Apr 17, 2020 2:23 am

Unexpected Trigger Fire

Post by zhenzh »

At the begining, I want to confirm a consensus against trigger firing mechanism in mudlet that any trigger can only be fired by new arriving lines after the point of time the trigger itself being created, isn't it?

If the above view is correct, the below scenario should not get the trigger fired:
  • new ling arrived
  • trigger matches the above line is created
Now I have a problem with the above scenario that a trigger is fired by lines arrived before its creation.
The issue only occurs when the trigger is created immediately after the matched line arriving.

Here's an example to easily re-produce the issue:
Create an one shot trigger #A with pattern line1, its send command is creating another one shot trigger #B with pattern line1 also. The purpose for such case is to get the exact action being run only when the line1 arrive twice.

The expected result is:
1. trigger #A created
2. line1 arrives
3. trigger #A fired
4. trigger #B created by trigger #A
5. line1 arrives second time
6. trigger #B fired

The current issue result is :
1. trigger #A created
2. line1 arrives
3. trigger #A fired
4. trigger #B created by trigger #A
5. trigger #B fired immediately by the previous arrived line1

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Unexpected Trigger Fire

Post by demonnic »

You should probably file an issue on github to discuss if this is a bug or not, but when you create a new trigger it is added to the end of the list of triggers to test the line against.

That being said, rather than creating triggers based on other triggers, I think a trigger chain is probably a better option. https://wiki.mudlet.org/w/Manual:Trigge ... ter_Chains

zhenzh
Posts: 68
Joined: Fri Apr 17, 2020 2:23 am

Re: Unexpected Trigger Fire

Post by zhenzh »

Yes, for permanent triggers, chain is a solution. While as for temp triggers, group is not supported.
I prefer temp triggers as there're a lot of one shot triggers applying in my mud game. Using permanent triggers may get my robot larger and larger.

As you mentioned, such firing order issue is probably caused by adding new trigger to the end of the list which is looping by trigger processing.
I'm going to open an issue in github and trying find out the root cause from source code.

Post Reply