playMaker

Author Topic: When is an int available for Int Switch?  (Read 2075 times)

spiceflo

  • Playmaker Newbie
  • *
  • Posts: 6
When is an int available for Int Switch?
« on: January 19, 2018, 06:08:23 PM »
Hi,

Description

I fill the variable actionId from a global variable actionId in the state "GetVariablesFromScript". After the Finished Event it transists to the next State "SelectAction". In this state I want to select an Event over "Int Switch" compared with the (local) actionId. If actionId is 1, then it should transits to the state "Command".

Problem

If I set a breakpoint to the State "SelectAction" everything works (with actionID = 1). Without a breakpoint on that State, my FSM stops on State "SelectAction" and it seems that the actionID is 0 and no Event will be fired.


Thank you very much and best regards

Florian

Screenshots without breakpoint





Screenshots with breakpoint





« Last Edit: January 19, 2018, 06:10:10 PM by spiceflo »

spiceflo

  • Playmaker Newbie
  • *
  • Posts: 6
Re: When is an int available for Int Switch?
« Reply #1 on: January 20, 2018, 10:52:42 AM »
Hi,

it seems that the FSM is too fast. If I add "Wait" in Action Browser with 0.1 seconds and the event "Finished" everything works fine.

But why do I need this 0.1 seconds? I thought that the Finished Event starts automatically, when the previous Actions are finalized.


Thanks and best regards

Florian

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: When is an int available for Int Switch?
« Reply #2 on: January 20, 2018, 11:27:50 AM »
Only the "Finished" event transitions automatically.

So it would seem when your int is 0 the corresponding event is not called?

What if you change the bottom switch to "selectResearch" to 0 instead of None, does that make a difference?

Instead of a wait you can also use a "Next frame event"
« Last Edit: January 20, 2018, 11:35:16 AM by LordHorusNL »

spiceflo

  • Playmaker Newbie
  • *
  • Posts: 6
Re: When is an int available for Int Switch?
« Reply #3 on: January 20, 2018, 07:12:57 PM »
Hi,

here is the solution:

I have a C# Script which fills the global variables and starts the Event in the FSM. In the C# Script, in the first stept you have to fill the global variable, and after that, you start the Event of the FSM.

Otherwise, you start first with the Event, and it takes too long too fill the global variables over the script.


Thanks for your feedback

Florian

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: When is an int available for Int Switch?
« Reply #4 on: January 20, 2018, 08:15:30 PM »
Quote
But why do I need this 0.1 seconds? I thought that the Finished Event starts automatically, when the previous Actions are finalized.

If you have multiple actions in 1 state they will start from top to bottom.
But they will not wait if the action above a finalized, unless you have enabled 'action sequence' (right click to enable)