JavaScript Advice

So I’m very new to Java in general but I’ve been following the advice on the notch manual and looking through some scripts on here and I’d have thought my script would be fine but I’m clearly missing something and have no idea what that is.

My scripts below and if someone could give me some pointers on where I’m going wrong that would be amazing, this issue has been bugging me for a couple of days now so would love to just get it out of the way.

function Initialise()
Log(“Math round v.01”);

function Update() {
layer = Document.FindLayer(“Fire in the Monkeys Head”);
node = layer.FindNode(“Accumulator”);
var valuex = node.GetEnvelopeValue(“Value”);
var OutputA = node.SetEnvelopeValue(“Math.round(valuex)”);


Thanks in advance!


It seems like your issue is in this line:
var OutputA = node.SetEnvelopeValue(“Math.round(valuex)”);

it should read something like this:
var OutputA = node.SetEnvelopeValue(“Value”, “Math.round(valuex)”);

Some tips:

  • Declare all of your variables at the beginning of the file
  • Then initialize them in the init function
  • Then use them freely

Not sure what version of JS notch is using but I’m sure it isn’t up to date as I can’t use let instead of var
(If someone at notch knows please let us know it would be very helpful in debugging instead of pulling up the log every time and making an educated guess)

Heya Nathan!

Thanks for the help! Had a chat with support and finally got it all working :+1:

1 Like