Could someone help me identify this error please? Error [tw-user-script-0]:Unexpected token']'

Twine Version: 2.3.5
Story Format: Sugarcube

Hello IF community,

Can some please help me identify this error?

Error [tw-user-script-0]:Unexpected token’]’

It pops up in the browser whenever I launch my story/game, which you can find here:

I’ve trawled the stylesheet and javascript files for anything that shouldn’t be there, i’ve removed all illegal characters from passage names, and i’ve cleared the contents of the first few passages to check I don’t have a mischievous character hiding in them; but all without success.

Obviously, I’m a Twine noob - so I don’t know of any systematic way to go about debugging it.

I’d really appreciate it if someone could give me a steer?

Happy to post any code too, please just let me know which part?

Thank you in advance. :smiley:

I’m curious where you sourced your JavaScript code from, because there are issues with it:

  1. In Iris[] newIris = new Iris[1000]; you are referencing the Iris class before it has been defined, and the syntax you are using to declare the newIris variable to be of a specific data-type in not standard JavaScript. eg. the Iris[] newIris part.

  2. The constructor of your Iris class seems to be referencing variables that aren’t defined.
    eg. width & height

  3. The drawIris() function has the same issues as point 2, as well as appearing to call undefined functions like noise()

  4. The color bckg = #000000, c1 = #ffffff; line also appear to be non-standard JavaScript syntax as it references a color data-type.

  5. The setup() function is defined but not used within the private Scope, and as defined would not be available (no within Scope) of the rest of the application.

Hey Greyelf,

Thank you for checking!!!

These mistakes are hangovers from old code I added to the JS, and have since deleted (note to self: use comments as reminders).

That’s now corrected, and all working perfectly :partying_face:

Thank you also for all your replies on forums down the years, they’ve helped me so much!