playMaker

Author Topic: [Solved]Updating FsmVariables from custom action scripts out of sync?  (Read 1865 times)

Webbstre

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Hello! I've now come across this problem in two very different custom scripts, so I thought I should report it. Basically I think that sometimes a script will update a variable internally but not simultaneously within the Fsm it is used in. For example, I've got a test project doing some arrays to spawn a very basic procedural generated box terrain. If I have a state machine assigning height to each X/Z coordinate box, and I use debug scripts I can see that everything is generating correctly, but for some reason within the Fsm the height variable is being assigned to the NEXT box in line, resulting in one box being at 0 height (due to a null value being assigned). I've since discovered this in a completely different project where a string is being updated a couple times within a function and part of the time the final output is not the correct string in the Fsm but appears correct in the internal Debug script. I can send a copy of the array project via a pm link if you'd like to see it for yourself.
« Last Edit: June 25, 2016, 11:48:08 PM by Webbstre »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3632
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Updating FsmVariables from custom action scripts out of sync?
« Reply #1 on: May 03, 2016, 12:12:43 PM »
Can you submit a bug report and attach the project?
The bug report gives us more info on your setup.

Thanks!

Webbstre

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: Updating FsmVariables from custom action scripts out of sync?
« Reply #2 on: May 03, 2016, 06:46:21 PM »
Sorry about that! Case 1514 for the bug report.

Webbstre

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: Updating FsmVariables from custom action scripts out of sync?
« Reply #3 on: May 07, 2016, 11:04:17 PM »
Any update on if this is a bug or I'm doing something wrong?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3632
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Updating FsmVariables from custom action scripts out of sync?
« Reply #4 on: May 10, 2016, 09:45:23 AM »
I couldn't find a bug #1514, but found #1454 Internal Script's Variable Value out of Sync with Fsm Variable Value. I'll take a look at the attached project today...

Webbstre

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: Updating FsmVariables from custom action scripts out of sync?
« Reply #5 on: June 25, 2016, 11:47:22 PM »
So... after a lot of practice making custom actions I've discovered what I think is the problem: Where you place or Finish() or other Fsm.Event() code in your function highly affects the way your FSM works. For example, some actions should not be placed in the same State in your FSM, because they will not finish what they are doing before moving on to the next action. Other times if you try to move on to the next State at what you would think would be the appropriate spot in your script then you will have sync errors like what I mentioned earlier in this thread.

I'll leave this for anyone in the future searching, but my advice is to spread out your Actions between events better and experiment with your code and everything should right itself.