Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do I map test/play error messages back to story html source lines?

My Javascript is rusty, and I've run across a few simple syntax errors since I dove back in with Twine. These took longer than they should have to resolve because the error message wasn't very helpful: "⚠ Uncaught SyntaxError: Unexpected token , (file:///Applications/Twine.app/Contents/Resources/app.nw/index.html#stories/6952c6bc-e9c1-6d9a-747b-cd017c79ca64/play: 125)". Test mode gave me almost the same error "⚠ Uncaught SyntaxError: Unexpected token , (file:///Applications/Twine.app/Contents/Resources/app.nw/index.html#stories/6952c6bc-e9c1-6d9a-747b-cd017c79ca64/test: 125)". I'm using Twine 2.0.8 on Mac OS X and the Snowman 1.1 story format.

Line 125 in my html file under Twine/Stories is a comment, and I can't find the 'play' or 'test' files (?) referenced in the error messages above. There are several entries in Twine.app/Contents/Resources/app.nw/index.html that might correspond to #stories, but no mention of 6952c6bc-e9c1-6d9a-747b-cd017c79ca64 or relevant mentions of 'play' or 'test'. That index.html file also seems to be all on one line, making the '125' (I assume it's supposed to be a line number) puzzling.
Where are those error messages pointing me? Is there a way to get more detailed debug information, such as the Twine passage name or the global Story Javascript line number where the error occurred?

Comments

  • The simple answer is You Can't.

    Based on the error message I would guess that the code within your Story Javascript area contains an invalid/extra coma somewhere around the 125th line.

    I say "around the 125th line" because there is not always a direct correlation between the lines in the Story Javascript code and the lines within the generated Javascript code after it has been converted by a web-browser.

    If you cut-n-paste the code from your Story Javascript area into a Text Editor (that supports line-numbers) then you will be able to locate the 125th line easier. Once there you generally start with that line and work your way up the file/code until you locate the bad coma. Depending on the structure of the code you may also be able to use tools JSLint to locate the offending coma.

    RE: in my html file under Twine/Stories
    If you are talking about the HTML files access via the Twine > Show Library menu item, then although those files do contain the contents of your story project they will not help you find relevant a line based on a line number.

    BTW: Welcome to the wonderful world of debugging HTML/Javascript applications.
    This is one reason why the "write small amount of code then test and debug" cycle is used.
Sign In or Register to comment.