Problem with JS Object code not running.

Does anyone know why the JS code below works fine in the "Init" section, (I've tested it) but similar code at the start of another section or passage does not? If I comment out the JS in the 'Get lamp' passage, it works as expected. Otherwise, no error message, but no result either.

@start Init

[[Init]]:
    var lamp = {room: "trophy room", desc: "A shiny brass lantern."};
    squiffy.set("lampRoom", lamp.room);
    lamp.room = "Test";
    squiffy.set("lampRoom", lamp.room);

   squiffy.story.go("Trophy Room");

[[Trophy Room]]:

There's a lamp here. [Get lamp]

[Get lamp]:
<!--
    lamp.room = "PlayerInv";
    squiffy.set("lampRoom", lamp.room);
-->

Test text<br>
{lampRoom}

I'm going to guess those comments don't work. I'm not that trained on squiffy comments but I think it's one line, starting with < and ending with >. Someone can correct me if this is wrong.

For JS code you are holding, I'd suggest using // comments (with four leading spaces) to make them JS comments, not squiffy ones.

Sorry - I'd test this hypothesis but I'm deep in my own storytelling and don't want to get out of the editor.


Thanks . . . but I didn't explain it very well. The comments work as expected, allowing "Test text", and the {lamproom} variable to display. But if you remove them -- so the JS at the start of [Get lamp] is active -- nothing displays from that passage (except the HR, showing that the game has gone to that part.)


Log in to post a reply.

Support

Forums