Book a Demo

Author Topic: EA not defined issue  (Read 7965 times)

mjoy

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
EA not defined issue
« on: December 05, 2021, 05:01:07 am »
I am getting into scripting for my projects to help automate some of the modeling.  Before I add anything, I wanted to experiment with it.

When running the Local Script - JavaScript1 I get an error that it cannot find the Maths library.  Is there some setup I need to do to point the scripts to the right place?

Do I need to install node.js in order to use the JavaScript?

I am using EA V15.1.1529 Unified edition.

Here is the code from the script supplied by EA:


Quote
function Apple(p1,p2,p3)
{
   this.color = p1;
   this.price = p2;
   this.name = p3;
   return this;
}

function main()
{
   var A = new Apple("green", 25, "Granny Smith");
   

   var e = 4.5000000000000001;

   

   var x = Maths.round(e);

   

   Session.Output(x);

   

   Session.Output(Apple.name);
   for (var a in A)
   {
      Session.Output( a );
      print( a );
   }
   Session.Output("this message was routed by Session COM Object embedded in java Script");
   if( Repository.App.Visible )
      print("visible");
   else
      print("hidden");
}
main();
« Last Edit: December 07, 2021, 04:35:25 am by mjoy »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Scripting set up
« Reply #1 on: December 05, 2021, 06:18:25 am »
it would probably be beneficial if you posted (parts of) your code.

q.