playMaker

Author Topic: If Statements  (Read 2262 times)

halas

  • Playmaker Newbie
  • *
  • Posts: 8
If Statements
« on: October 30, 2017, 12:55:25 AM »
Hey Guys,

Noob here, just curious how I work If statements...

Am I using Bool Values for If statements?
For example,
If (Variable) is true, activate - Trap
If (Variblee) is False, do nothing.

peaks

  • Playmaker Newbie
  • *
  • Posts: 27
Re: If Statements
« Reply #1 on: October 30, 2017, 03:21:42 AM »
Hej, you can use the "bool test"-action for your example.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: If Statements
« Reply #2 on: October 30, 2017, 03:52:29 AM »
Hi,

 Peaks is right,

 you'll have state with your "Bool test" action, and two transitions ( like "YES" "NO", "TRUE" "FALSE" "DO THIS" "DO THAT") and the bool test action is going to let you transit to another state based on the value of the fsmvariable you are going to test.

 If you still have problems, I would suggest you either look at some of the videos on youtube for beginners, or check out the various samples on the Ecosystem. to see fsms in actions.



Bye,

 Jean

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: If Statements
« Reply #3 on: October 30, 2017, 08:38:18 AM »
Just to expand on this answer a little, a common pattern is to use questions to name simple branching states, and the event names are the possible answers. So the graph reads more like a flow chart. This pattern is easy to read and understand - important as a project grows and you revisit parts that you made a while ago!

halas

  • Playmaker Newbie
  • *
  • Posts: 8
Re: If Statements
« Reply #4 on: October 30, 2017, 05:09:17 PM »
Ok so What I have done:
Bool Test
If "trap" is true -> run trigger.
If "trap" is False, blank

When character steps on plate, trigger event
Bool Flip

But the trap is still running as true
I did check off Every Frame

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: If Statements
« Reply #5 on: October 31, 2017, 01:45:38 AM »
Hi,

 Are coming back to that "bool test" state when the player is triggering the platform or plate?

Bye,

 Jean

halas

  • Playmaker Newbie
  • *
  • Posts: 8
Re: If Statements
« Reply #6 on: November 02, 2017, 12:09:48 AM »
I got it to work by doing set bool value rather than bool flip.

Doesnt make sense, but hey it works

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: If Statements
« Reply #7 on: November 02, 2017, 02:11:38 AM »
Hi,

 yep, in order to test a bool, you need to use bool Test, but maybe in your case your issue is not the test but when to set the bool to the right value for it to be tested later.

 bye,

 Jean