Formatting errors and finding the needle in the haystack

Hello, new to this forum so apologies if I break any rules.

I am getting an error when I run my code that speaks of formatting issue regarding tabbing and extraneous spacing around particular rules. I had no errors when everything was in the story.nl but since then I modularized everything and split out into extensions and including them. Basically I cut code out of the main .nl file and pasted into i7x files created in VSCode then installed them as extensions.

Does anyone have ideas how I can easily find what Inform is complaining about? Sure I scanned the code, I looked at the statements before and all looks good, I deleted tabs, and retabbed, etc. Does inform7 offer the capability to compile/interpret one file at a time and see that confirmation so I know that it is good? Or is there a recommended editor for story and extension code that color coordinates or line links matching delimiters (, [, ", ’ and highlights control characters like tabs?

Here is sample code (it’s currently commented out that Inform complains about )

Instead of going west in North-Of-Camp:
    if player does not have backpack:
        say "It would be a good idea to grab your backpack.   Leaving it might open yourself to having it stolen or someone thinking you met with foul play.";
    else if the player is not enclosed by your-raft:
        say "There is no reason to go swiming now when you have a nice yellow inflatable raft.  A lot safer too.";
    else if player does not have lifevest:
        say "It would be a good idea to put on your lifevest.   You are a pretty good swimmer but no sense being dumb.[line break]And besides, it's the park rule while rafting.";
    else:
        say "You push off into the calm water.";
        now player is in your-raft in Lazy-River.

I’m not sure how dependent your extensions are on each other, but you could try making a simple game (like “Lab is a room.”) and a line including just one of the extensions, and see if it compiles.

2 Likes

Sounds good. Does Inform care if I put all my includes in the main .nl file? Or if I have an extension B that is only used by another extension A, does that include belong in extension file A?

Extensions can include other extensions. I think I’d try one extension at a time, though, if possible, if I were trying to figure out what was compiling and what wasn’t.

2 Likes

Yeah, agreed. The simplest approach might be to just include each extension in your main story file, comment them all out, then uncomment them one by one.

And FYI sometimes when you get these errors, the issue might not be in the lines the compiler flags, but in the ones above them – that might help narrow things down when you figure out which extension is the culprit.

3 Likes

I’ve had great luck with Visual Studio Code with the Inform 7 extension: Inform 7 extension for VS Code - #5 by Celtic_Minstrel

1 Like

Believe it or not, Inform was complaining about the rules with if statements in them with the colon tab indent syntax. Thank goodness I found the explicit begin; end if; syntax. Of course might have missed the memo/demo but this also meant I had to refactor else else if and otherwise clauses with if xxxx begin; yyyy end if; syntax. Could not seem to get an end if to work following an else or otherwise or else if clause.

I see you’ve solved – or at least worked around – your issue, but I think it’s worth reiterating for the benefit of others finding this thread:

I find this to be very common – particularly when the preceding line is terminated incorrectly.

1 Like