Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: mrosswa on November 24, 2013, 10:13:04 AM

Title: Send variable from script to PlayMaker.
Post by: mrosswa 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)?
Title: Re: Send variable from script to PlayMaker.
Post by: MrMitch on November 24, 2013, 06:21:16 PM
Get Property should work.
Title: Re: Send variable from script to PlayMaker.
Post by: jeanfabre 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