playMaker

Author Topic: If Statements  (Read 135 times)

halas

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
If Statements
« on: October 29, 2017, 09:55:25 PM »
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: 18
    • View Profile
Re: If Statements
« Reply #1 on: October 30, 2017, 12:21:42 AM »
Hej, you can use the "bool test"-action for your example.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: If Statements
« Reply #2 on: October 30, 2017, 12: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: 3202
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: If Statements
« Reply #3 on: October 30, 2017, 05: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: 5
    • View Profile
Re: If Statements
« Reply #4 on: October 30, 2017, 02: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: 12342
  • Official Playmaker Support
    • View Profile
Re: If Statements
« Reply #5 on: October 30, 2017, 10:45:38 PM »
Hi,

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

Bye,

 Jean

halas

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Re: If Statements
« Reply #6 on: November 01, 2017, 09:09:48 PM »
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: 12342
  • Official Playmaker Support
    • View Profile
Re: If Statements
« Reply #7 on: November 01, 2017, 11:11:38 PM »
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