playMaker

Author Topic: Get a static variable from a js script  (Read 2738 times)

kidwithacomputer

  • Playmaker Newbie
  • *
  • Posts: 18
Get a static variable from a js script
« on: January 20, 2015, 12:32:58 PM »
Hi, I've been trying to figure out how to get a static variable from a microphone script I got from the asset store. I see the Get Property action doesn't read static variables, and I need to make a wrapper for the variable, but alas I am dumb.  :-\ I've been trying to get it working, and will continue to try, but in the meantime I thought I'd see if anyone can help.

static var loudness:float; is the line I need to wrap.

I found this snippet of code from this post explaining the wrapper:

Code: [Select]
public int TileInt
{
get { return (int)tileTypeMask; }
set { tileTypeMask = (TileType)value; }
}

I am trying to connect the two but so far I only get errors. Is it anything like:

Code: [Select]
static var loudness:float;

public float loudnessPublic
{
get { return (float)loudness; }
set { loudness = (loudnessSet)value; }
}

I know that's not right but figured it might help to start someplace... also is it different for c# vs js? The script I need the static variable from is javascript.

Any guidance is appreciated, thank you!

kidwithacomputer

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Get a static variable from a js script
« Reply #1 on: January 21, 2015, 11:50:06 AM »
Bump  :)

Arialle Körsbärsträden

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Get a static variable from a js script
« Reply #2 on: February 02, 2015, 06:08:10 PM »
I am not exactly experienced in this matter, but, I do not see why you need to use C# to get access to a JavaScript variable. I am totally guessing on this, but see if that works~!

Code: [Select]
function loudnessPublic(){
return loudness;
}