I’ve posted a bug report which involves the inability of C2 triggers to process System object actions/expressions. And I personally doubt that such a fix is within the scope of C2 so I figured I had to make a workaround. The gist of the problem is that sending out triggers to multiple Objects does not yield all of them responding in a like manner, or even a contextually similar manner. It seems like the processing of the Object triggers occurs inside the timespan of the all the Objects’ triggers. So when looking at the browser console, you don’t see the message reflecting each and every Object that had its trigger run. But if you used certain conditions and actions (of the Object that was being triggered), then it will work.
So my goal is to create a way to send out triggers to specific Objects and have them individually reflect and do their thing based on what the trigger was.
Using Rex’s FSM (FiniteStateMachine), I was able to get something working. But it isn’t as straightforward, hence the need to document this now.
I currently work with one FSM behaviour on those that have some sort of AI or any need of states. So I create another FSM object called ‘trigger’ for the objects that need a trigger structure. I’ll call this the FSM Trigger.
Before I started using FSM Trigger, I was using a variable called receivedtrigger and using ‘Trigger once while true’ in order to activate it.
The FSM Trigger’s purpose is to receive a trigger string (FSM state). When it receives this, it is free to use System expressions and actions. However, because of some reason, you can’t call another FSM state changes within the FSM Trigger. This causes a loop, and I’m not sure why. (Might still investigate this in the future)
So the method, now, is this: the FSM Trigger is called, and does its evaluation, which is essentially picking out which Object it needs to send the trigger to. Remember that I wasn’t able to sift through the Objects because there was no way of knowing of processing the trigger individually. Now, because of FSM Trigger, each Object can be queried using System expressions or actions.
Then in the FSM Trigger, I make a specific ‘Trigger once while true’ call’ using the receivedtrigger variable. This initiates the C2 ‘trigger once’ method on the instance that I want.
A forum poster explained the nature of the ‘Trigger once while true’ system, which allowed me to modify the trigger without the use of FSM, which is good, because I will only need to manage one trigger.
The gist of the issue is that when a ‘Trigger once while true’ is run, it is not the same kind of trigger like FSM where the object is implicitly picked. The ‘green arrow trigger’ might be a clue to the difference.
Either way, the ‘Trigger once while true’ (TOWT) trigger is special condition, not truly the same kind of trigger found in other parts of C2, and there is no individualised context of the trigger. So when a TOWT trigger is run, the context is global, so that all of the instances of that trigger is picked. You have to refine the pick further more.