playMaker

Author Topic: Need help with Input  (Read 1710 times)

Atanvaryar

  • Playmaker Newbie
  • *
  • Posts: 2
Need help with Input
« on: March 12, 2014, 03:58:20 PM »
Hi, I've recently bought Playmaker and find it really awesome. I've already messed around with quite a few FMSs, I've created events and fired them from custom scripts and the other way round.
But I cannot, for the life of me, figure out how to react to a button press using just the FSM.

What I've tried:

create an FSM with two states:
1) Start -> Listener
2) DisplayGUI

In the Listener there are two actions:
Get key (every frame)
Bool Test (every frame)

When the Key gets pressed, the press is stored, the bool test is passed and the event is fired to move to state DisplayGUI.
Everything works. The event gets fired, the state changes correctly.
But it stops working if on the second state I set up the same config:

State DisplayGUI:
Get key (every frame)
Bool test (every frame)

I want to press the same key and then fire the event to get back to listener state and stop displaying the gui. What I get is the error:

HUDManager : FSM : Loop count exceeded maximum: 1000 Default is 1000. Override in Fsm Inspector.

Can someone help me out please?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Need help with Input
« Reply #1 on: March 12, 2014, 04:19:53 PM »
Use Get Key Down to fire the transition in this case.

What happens is Get Key and Bool Test happen super fast and you touching the button will give it enough time in the downed position to fire the event over 1000x/sec and throw a loop exception error. Get Key Down will wait for the key to be pressed down after entering the state, rather than getting its status immediately and pushing it to a bool.

Get Key + Bool would be good if you were exiting with an up position, for instance holding a key down to bring up the UI.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Atanvaryar

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Need help with Input
« Reply #2 on: March 13, 2014, 12:11:20 AM »
Thanks a lot! I knew it should've been something super easy and I was just looking the wrong way!
Will try it out today :)