Scripting

 From:  Michael Gibson
7238.50 In reply to 7238.49 
Hi dune 1982, well the error message there says "Invalid return statement". I think that the only way you'd get that is if that return statement is not inside of a function.

Does your code in schra.js just start off a bunch of direct global code? If so then you can't use a return statement in it. If you take a look at the scripts that are distributed with MoI you'll usually see (unless it's very simple code with no "bail outs" needed) the main code is in a function and then at the bottom of the file the function is called - it's structured that way so that it's a bit easier to bail out of the code at anytime by putting in a return statement like the one in your error message.

See for example commands\Trim.js - it's set up like this:

code:
function DoTrim()
{
      <.... Whole bunch of code goes here .... >
}

// Call the function, any code inside of DoTrim can bail out by a return statement.
DoTrim();


But if your code is not in a function you will get an error message like you post if you try to use a return statement...

Does that explain what you're seeing? If not then yes please send me the code so I can take a look, you can post it here or e-mail it to me at moi@moi3d.com if you want to keep it private.

- Michael