playMaker

Author Topic: Access "if" statement on a script from FSM  (Read 1882 times)

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Access "if" statement on a script from FSM
« on: July 09, 2014, 01:19:23 PM »
Hello, I'm trying with no result so far to make a state to trigger an "if" statement on a script attached to another object or more specifically to set a float on the script. Here's the example:

I need to make "throttleInput" to be "1f;" with an FSM attached to another object, which would in the given example be equivalent to button touch.

Code: [Select]
if (t.phase != TouchPhase.Ended &&
    this.throttleButton != null &&
    this.throttleButton.texture != null &&
    this.throttleButton.texture.HitTest(t.position)){

throttleInput = 1f;

Color c = this.throttleButton.texture.color;
c.a = this.throttleButton.alphaButtonDown;
this.throttleButton.texture.color = c;
}

Any help will be much appreciated.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3998
  • Official Playmaker Support
    • LinkedIn
Re: Access "if" statement on a script from FSM
« Reply #1 on: July 09, 2014, 03:22:31 PM »
There's no way to call a specific block of code. What you can do is call Methods or access Variable in your scripts.

So you could put code in a Method and call it from Playmaker using Send Message, Invoke Method, Call Method etc.

Or you can get/set a variable in your script using Get Property and Set Property.

Does that help?