Tern error? what is that?

Every time I go to add a new line to my script, I get a little blurb saying Tern Error line (some number here) is outside of project. Is there a limit to how many lines my script can have or is something else going on? I’ve tried searching on Google, as well as looking through the API but haven’t found anything.

Please add a screenshot or link to your script. It could be you have a misplaced semicolon or character of some kind.

Here’s a screenshot of the error. I have realized that I made a small mistake in describing it, it doesn’t say line then the number, it says position. The number changes as I add more characters to the line as well. I have tried copying the code into a new file and got the same thing when I attempted to add another line

Here’s the link to the code as well, couldn’t hurt to have someone else look over it.

Having a quick look, it expects there to be a newline at the end of file so create a newline and write code above it.


That’s just it, the getRandomInt function is supposed to be the end of the file, I only added that new line to show what the error is. I don’t remember exactly where in the file the error started, but once it started most of the script was written without the autocomplete, which turned itself off around the same time.

After removing some code, I’ve found that the error first appears somewhere between line 200 and 250. If I remove all of the functions from stopCheck down the error goes away.

And after further testing, anything after line 250 seems to get this error.

I haven’t ran into this issue as long as there is a blank newline at the end of the file: https://playcanvas.com/project/530321/overview/dicematch-from-forums

I think you misunderstood. You need a blank newline at the end of the file. So in the image below, you can see line 791 is completely blank and you need to write code above it. It’s a limitation/rule on the linter of the code.

Oh ok, I see now. I’ll give that a try.

That solved the weird tern thing alright, I guess my problem is something else since the script still doesn’t parse.

You have 2 errors when running:

If you click on the orange text, it takes you to the code editor and the line where it thinks the error is.

On line 268:

RollDice.prototpye.startCheck = function()

prototype is spelled incorrectly.

On line 74

    dice1 = app.root.findByName('Dice1');

app hasn’t been defined. You need to use this.app instead of app here.

Always those little spelling mistakes that someone else ends up finding.

And thanks, I’m not too well versed in javascript as it is, so trying to make use of an engine like this that adds its own little changes is making things somewhat more difficult.