Is this a bug in Stencyl? [Windows]

Omniso

  • Posts: 192
I have four actors (turrets) in an initialized list that all have a custom event with the same name that makes them  fire at the player.  For some bizarre reason, the 1st actor at the start of the list refuses to execute it. There is no error during runtime, nor can I print from the dysfunctional actor because the event is never called. The literal code line"actor.shout" is completely ignored on the 1st execution or is called on the wrong actor (which behavior that occurs has been random throughout identical test runs). It's only when I try triggering this event from a "For" loop that each actor fires correctly at the same time, and then suddenly they will correctly fire in order from C1 -> C2 -> C3 -> C4  from the original timed-event code only once, before returning to C4 -> C2 -> C3 -> C4 forever until the for loop is executed again.

I've actively displayed the data contained within C Section, C1, C2, C3 C4 during runtime, and none of the data is ever changed/corrupted at any point to cause this strange behavior. In fact, there are other sets of sections that follow the exact same structure (e.g. list named B Section with 4 actors named B1, B2, B3, B4) and they never exhibit this kind of behavior.

merrak

  • *
  • Posts: 2598
This is a bit of a long-shot, but is the only thing that immediately jumps out at me. Tweening over 0 seconds isn't recommended. Change this to 0.01.

Omniso

  • Posts: 192
Thanks for the suggestion. I tried it and unsurprisingly the issue still persist. For test runs where triggering Fire on turret C1 would trigger on C4 instead, I tried a new means of troubleshooting where I had each turret create the laser actor at their exact X position, and added the following to the event Fire.
Print: self
Print: X of self
Print: X of the laser actor
I then had each turret fire in this order: C4 -> C3 -> C2 -> C1

So apparently, when triggering the event does do something, Turret C1 seems to assume the properties of Turret C4. I don't know what to do or think at that point, because that completely defies logic with no explanation. No matter what information I get, no matter what blocks I put in, it doesn't change the fact that C1 miraculously thinks its C4, or sometimes thinks it doesn't exist at all.

merrak

  • *
  • Posts: 2598
One thing to look out for is using attributes in a do after wrapper. Their values can change before the code executes. I'm on my phone so I can't get a good look at your code, but check for that issue. There may be problems in code you didn't share as well.

Omniso

  • Posts: 192
So I removed the "Do After" wrapper, and all turrets fired correctly similar to the "For each" loop method. Strangely enough, if I split the 4 turrets and have them fire in groups of 2, they still function as intended. It's only when I have them fire one at a time with "Do After" blocks does this inexplicable behavior occur.  You said that attributes can change their values before the code executes, but I'm actively drawing each attribute involved directly on the screen. None of their values are visibly changing. As far as the code tells me, each actor attribute is correctly set to their corresponding turret, and placed into the C-section list.  What shocked me was that even [X of actor] reported the value for a different actor. . . WITHIN the actor it was executed in.

This is the entire code of the C section . Ignore the code related to the Power Unit and Central core, as they have nothing to do with the issue nor do they affect the turrets in anyway. There is an update event for the turrets that sets the position of the laser actor, but this was removed for debugging, so the only thing that's left is the Custom Event "Fire".

Why would the "Do After" wrapper cause values to change?

« Last Edit: June 06, 2020, 06:03:02 pm by Omniso »