Howdy, Stranger!

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

What is wrong in this code?

So, I am making a game, where, at one point, you can find a card, which will later be used to open a locked door.
First part is when I set the variable "card" to 1
<<set $card to 1>>

And here is the code to display an option to use the card to open the door.

<<if $card is 1>> use card on the card reader -> room 2 <<endif>>

I have coppied the code from the Twine wiki and altered it, but the option to use the card on the door displays everytime, even when the player has not found the card.

Can you tell me, what is wrong with the code?

Comments

  • Nevermind. It was fixed by switching to SugarCube.
  • If you are going to use the -> based markup link then you need to make sure not to add space characters after the -> keyword, because those extra space characters are added to the start of the name of the passage automatically created and passage names should not start with spaces.

    Your link should look like this:
    [[use card on the card reader->room 2]]
    

    I am guessing that you were use the Harlowe story format and the it's macro syntax is different to what you were trying to use. Your code should of looked like the following:
    (set: $card to 1)
    
    (if: $card is 1)[ [[use card on the card reader->room 2]] ]
    
Sign In or Register to comment.