Howdy, Stranger!

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

My StoryMenu ignores my settings

Its driving me nuts, but it seems that the links in my side bar ignore if I've visited a page or not.

at start I told it to <<set $visitedGarden is "no">>

In the StoryMenu, you can access a map that when you visit a place adds a picture. But every time I try to access the map from the start page it has all the pictures already in.

Anyone got a solution?

Comments

  • Without seeing your code, I can't say why it is doing what it is doing, per se... but I can tell you how to get the effect you want.

    What are you using? I assume SugarCube but since (it looks like) you are in Twine 1, I don't really know.

    My suggestion is to check the player history and see if a passage has been visited, and if not, then don't show the map. Only show it once they have visited.

    But I can't give you exact syntax without knowing more.
  • Sage
    1. Ya I'm using SugerCube. specifically in Twine 1.4.2
    2. My code is this

    In the Start passage
    <<set $visitedGarden = "no">>

    On the Garden page
    <<set $visitedGarden = "yes">>

    In the StoryMenu
    Map

    In the Map

    <<if $visitedGarden = "yes">><<img src="Garden.jpg" alt="Garden" style="width:250px; height:250px">><<else>><<img src="Question.jpg" alt="Question" syle "width:300px; height:290px">><<Endif>>

    However even if I haven't visited the Garden page, like I click Map in the StoryMenu, I still get the image of the Garden in the map.
  • 1. SugarCube or Sugarcane?

    2. If you actually are using SugarCube, do not put non-menu items in the StoryMenu special passage, that is not what it's for. You should use the StoryCaption special passage instead.

    3. Your chief issue is that you're using assignment operators in your conditional expressions, which is throwing the logic off. Also, don't capitalize macro names. And, your <img> HTML tags have too many angle-brackets.

    In other words, this:
    <<if $visitedGarden = "yes">><<img src="Garden.jpg" alt="Garden" style="width:250px; height:250px">><<else>><<img src="Question.jpg" alt="Question" syle "width:300px; height:290px">><<Endif>>
    
    Should be something like this:
    <<if $visitedGarden == "yes">><img src="Garden.jpg" alt="Garden" style="width:250px; height:250px"><<else>><img src="Question.jpg" alt="Question" syle "width:300px; height:290px"><<endif>>
    
    Or better (using the is operator):
    <<if $visitedGarden is "yes">><img src="Garden.jpg" alt="Garden" style="width:250px; height:250px"><<else>><img src="Question.jpg" alt="Question" syle "width:300px; height:290px"><<endif>>
    
Sign In or Register to comment.