Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
bug-> SyntaxError: missing ) after argument list

DouweDabbe
Guest
Quote
2022-06-13 07:04:32

My script is completed but
at reloading the extensions and plugins in CC
the Message Log complains about a bug that I cant find:

"SyntaxError: missing ) after argument list"

Any ideas? General Tips?
What is your recipe for a methodological debugging strategy?

I counted all the hooks and curly braces and they match.
then I checked my parameters and local vars.

npp jsLint stops after 34 %, complaining about using to many undeclared ccb functions, yeah right...

with this error the script is not loaded so can not realy see what is good or bad.

Debugging of this JS stuff is really horrible when compared to programming 30 years ago.


nigec
Registered User
Quote
2022-06-13 08:59:18

I use Visual Code and print (); .... A lot


okeoke
Registered User
Quote
2022-06-15 13:12:48

Hi,

I believe, you can use webgl target to debug using chrome devtools. At least, I think it works:) My project doesn't really work with webgl.

Another thing you can do create a 2d overlay named debug. Make it show variable values of variables named like debug1, debug2,debug3. Add a behavior which updates the text on each frame. You can also add hide/unhide behavior for it. If you need to check some variable value - just use a built in funciton to set these debug1, 2, 3 etc variables with its value.

Linters are usually configurable, so you need to exclude the rule which doesn't work for you. I never used jslint, is it linter for notepad++? If so you can use global scope to specify all ccb functions as described here under the directives section. https://www.jslint.com/help.html

Also try using visual studio code - it's fast and lightweight. If you need some specific functionality - there is a plugin for that or you can write your own using JS. It usually does good job highlighting the syntax issues.

My guess is that you forgot comma or + somewhere in the function call.


DouweDabbe
Guest
Quote
2022-06-17 06:13:22

I resolved the Issue this way:

from template I recreated the wanted action and
then selectively brought back-in segments of my broken code.
That worked out well, although i "only" lost a day or two.

There can be many invisible issues in js code:
-------------------------------------------------------------------------
- npp using a wrong charset.
- npp using illegal whitespace character.
- npp using a minus sign that is not a minus but a short line.
(this happens specifically when I copy code fragments from pdf's).


Most common bugs sofar:
-------------------------------------------
- code works with meshnode name that does not match with actual name in my scene.
- code works with meshnode property "TEXT" that has not yet been enabled.
- code works with meshnode property that is spelled incorrectly "visebility" .
- code stopped working due to attempt to clean up code,
moving parts,
renaming vars,
changing the parameter interface but not renewing action call in the scene.
Pretty Code Can Cost a lot of time !!!
- using true and false in stead of if ( !outcome ) { ... }
- using true and false in stead of 1 or 0 one or zero.
- my variable iPixels is not an integer but a string object
var myTrueInt = Number(iPixels) * Math.PI;
- my vector3d does not allow quick dirty calculus.
- myVar needs a "this." prefix.
-parenthesis mismatch after code cleanup:
if ( ( ... ) && ( ... ) ) became simpler: if (( ... )


Tip:
=====
in the windir: /Users/Me/Documents/CC/extensions
i placed a file called: all-my-bugs.txt.

In it,
- I record all error messages that I get and
- the code that causes them and
- my solution to them.
This really helps a lot to find solutions !!!

Thank You All;


nigec
Registered User
Quote
2022-06-17 11:18:06

The pdf thing , It used to be an issue when doing flash as2 code, spent many hours pulling my hair out over dodgy "" symbols lol


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact