playMaker

Author Topic: Problems getting simple wait timer to work  (Read 4399 times)

turkeypotpie

  • Playmaker Newbie
  • *
  • Posts: 22
Problems getting simple wait timer to work
« on: January 11, 2013, 03:59:37 PM »
I have a very simple case:

State 1 (start state)
  No actions
  Transition (FINISHED) to State 2

State 2
  Contains a Wait action with time of 1 second and Finish Event set to WAIT_FINISHED
  Transition (WAIT_FINISHED) to State 1


For me, this VERY SIMPLE case DOES NOT WORK.  It loops around once, but not forever like it should.  If I used the FINISHED event, instead of my custom WAIT_FINISHED event, then it works ok, but this isn't what I want.

Also, if I comment out a line in the OnUpdate of Wait.cs :

Code: [Select]
if (timer >= time.Value) {
    Fsm.Event(finishEvent);
    //Finish();
}

... then it works ok.

Does this problem happen for others too?  Or am I just missing something with the way this should work?


DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: Problems getting simple wait timer to work
« Reply #1 on: January 11, 2013, 05:29:10 PM »
When you call "Finish()" function you are finishing the state actions, thus no loop will be executed, whether there is or not a transition. If you want to have it looping forever, do not call "Finish()".
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8

turkeypotpie

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Problems getting simple wait timer to work
« Reply #2 on: January 11, 2013, 05:52:11 PM »
When you call "Finish()" function you are finishing the state actions, thus no loop will be executed, whether there is or not a transition. If you want to have it looping forever, do not call "Finish()".

So how do I fix my problem without modifying the PlayMaker source code?

Ticked_Off_Pixel

  • Playmaker Newbie
  • *
  • Posts: 31
    • http://happystar-adventures.tumblr.com/
Re: Problems getting simple wait timer to work
« Reply #3 on: January 15, 2013, 09:37:47 PM »
I'm having this problem also!

I just fixed it using Finish Event: FINISHED.

When I created a new Event name, I was having turkeypotpie's problem.

You can also use Send Event, with a delay.
« Last Edit: January 15, 2013, 11:14:13 PM by Ticked_Off_Pixel »

turkeypotpie

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Problems getting simple wait timer to work
« Reply #4 on: January 16, 2013, 12:32:04 AM »
I'm having this problem also!

I just fixed it using Finish Event: FINISHED.

When I created a new Event name, I was having turkeypotpie's problem.

You can also use Send Event, with a delay.

Yeah as I was saying, using the FINISHED event does sort of fix the problem, but for me, I have an input action on my wait state, which transitions into another state.  FINISHED won't work with that.