playMaker

Author Topic: Send variable from script to PlayMaker.  (Read 1945 times)

mrosswa

  • Playmaker Newbie
  • *
  • Posts: 1
Send variable from script to PlayMaker.
« on: November 24, 2013, 10:13:04 AM »
I have a very simple JS script that looks like this:

var objectisvisible = false;
function Update(){

if(renderer.isVisible){
 
objectisvisible = true;
}
else
{
objectisvisible = false;
}
}

I'd like to pass that boolean out of the script and into playmaker so it can activate a state when it's true. It looks like it should be simple according to the tutorial videos but I've never done any real programming beyond ActionScript and I can't figure it out. What do I need to do to make this script pass out that variable (I assume with Get Property)?

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: Send variable from script to PlayMaker.
« Reply #1 on: November 24, 2013, 06:21:16 PM »
Get Property should work.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Send variable from script to PlayMaker.
« Reply #2 on: November 28, 2013, 05:20:51 AM »
Hi,

 You need to make your property public, that's the key to expose it inside the "Get Property" action.

also, I would actually recommand you fire a playmaker global event from your scripts when you detect a change of that visibility, it's better imo.

Code: [Select]
PlayMakerFSM.BroadcastEvent("my event");
you need to declare the use of playmaker at the top of your script as well

Code: [Select]
using HutongGames.PlayMaker;

 Bye,

 Jean