playMaker

Author Topic: multiple float compare on the same state  (Read 735 times)

Redome

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
multiple float compare on the same state
« on: September 30, 2019, 01:28:41 PM »
Hello,

I'm triying to put multiple actions "float compare" on the same state, but playmaker only checks the first one, once it gets the first "float compare" as positive, it won't check the others.

Thore

  • Sr. Member
  • ****
  • Posts: 480
    • View Profile
Re: multiple float compare on the same state
« Reply #1 on: September 30, 2019, 05:17:54 PM »
Mind the order of them: if you check for larger than, go from largest to smallest. If you check for smaller than, arrange them from smallest to largest. Right click and action sequence might also help.

Athin

  • Full Member
  • ***
  • Posts: 152
    • View Profile
Re: multiple float compare on the same state
« Reply #2 on: October 01, 2019, 02:57:57 AM »
Heya,

If you put multiple compares in the same state then make sure the event is blank if you want to reach the other compare actions.  Otherwise it will fire off whatever event it reaches first.

As Thore said, the order is very important depending on what your doing for this to work right.

cel

  • Full Member
  • ***
  • Posts: 111
    • View Profile
Re: multiple float compare on the same state
« Reply #3 on: October 01, 2019, 04:38:17 AM »
I think I'm having a similar issue... my compares are equal instead of greater or smaller than, but I don't get the leave event blank as said by Athin, how would the state progress then?

Athin

  • Full Member
  • ***
  • Posts: 152
    • View Profile
Re: multiple float compare on the same state
« Reply #4 on: October 01, 2019, 05:23:16 AM »
Heya,

This all depends on what you are trying to do.  I'll give an example.

You have the following variables, X=5 and Y=10 and you want the event "complete" to fire off if both variables are greater then 3.

You can use two float compares in the same state for this by first checking X.  If X is greater then 3 have the event BLANK.  Under that action is another compare for Y.  In that action have the greater event fire off "complete".

Remember FSM States start from the top and only move to another state as soon as it receives a transition event.  Leaving events blanks lets the rest of the state do its thing.

Bit of a rush here so sorry if still unclean but hope that helps.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15443
  • Official Playmaker Support
    • View Profile
Re: multiple float compare on the same state
« Reply #5 on: October 01, 2019, 06:20:45 AM »
Hi,

 you cascade through several compare by leaving some comparision blank like this.



Bye,

 Jean

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 634
    • View Profile
Re: multiple float compare on the same state
« Reply #6 on: October 02, 2019, 05:36:56 AM »
There's a Float Compare Range action too, but you'll have to do tests before because it's not very intuitive.
Actually I think I even had to modify it a bit because it annoyed me.  ::)