playMaker

Author Topic: Basic Boolean Return Value Usage  (Read 902 times)

Oneton

  • Playmaker Newbie
  • *
  • Posts: 2
Basic Boolean Return Value Usage
« on: April 28, 2020, 11:40:46 AM »
Hey all,

I'm new to PlayMaker and have a question about usage practices of function return values.

In my scenario, I have a script and method that returns a boolean.  I'd like to use the boolean return value from this method directly to make an FSM action (rather than having to create an FSM variable, stuff the method result into it, and use that variable to make the decision).

Is this possible?  If so, any links to examples or older threads that discuss this would be appreciated. 

Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Basic Boolean Return Value Usage
« Reply #1 on: April 29, 2020, 03:17:18 PM »
Hi.
you can have a fsm with some states and events and send a event to trigger those actions.

Have a look at the Playmaker API

Oneton

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Basic Boolean Return Value Usage
« Reply #2 on: April 30, 2020, 11:07:55 AM »
I don't think I made my question very clear so let me ask again by using an example of the current solution (as far as I know).

Let's say I have a class MyClass with a function bool IsReady() { return state == Ready; }

In PlayMaker, in order to act on this function's return value, I have to jump through a few hoops that seem unnecessary.  I need a variable to store IsReady's return value in, I need a CallMethod Action to call it and store it, then I need a BoolTest Action to check the variable for its value.  That's quite a bit of additional overhead when what I'd really like to do is just check IsReady()'s return value and act on it directly (without storing the result in a variable).

Does my question make sense now? 

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Basic Boolean Return Value Usage
« Reply #3 on: April 30, 2020, 05:23:41 PM »
Hi.
Have a look on the Ecosystem
You can find many custom action and several 'fsm' actions.
for example look for 'Fsm Bool test'

you will still need to set a bool on the target fsm