Howdy, Stranger!

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

Using (if:) and (history:) to change text in Harlow? [SOLVED]

edited August 2016 in Help! with 2.0
Hello! I'm fairly new to Twine, but I've been reading a lot of questions on here and using the Harlow 1.2.2 manual on twine2.neocities.org, but I still can't figure something out.
I'm using (if:) and (history:) to change the text print out depending on whether or not the player has been there before. If they visit the passage a second time, I want to remove the original text and replace it with something new.
Currently, my code looks like this:

(set: $list to (history:))

(if: $list contains "Enter Crowded Cafe")[You carefully approach the two spirits talking. You make a weak attempt at a smile and stand until they notice you.
"Um..." you fumble with your words, "Are you Rowan?"
The first spirit turns to you. She looks like she's tired. "No, I'm not."
"Oh. Thanks." Well, you havent found them yet.
Ask her friend?->Spirit Friend Ask
You walk away from the spirits.->Crowded Cafe]

(if: $list contains "Rowan Spirit?")[Your remember your first meeting... *You carefully approach the two spirits talking. You make a weak attempt at a smile and stand until they notice you.
"Um..." you fumble with your words, "Are you Rowan?"
The first spirit turns to you. She looks like she's tired. "No, I'm not."
"Oh. Thanks."*

You're not sure why you're back. The first spirit turns to you, "You again? I already told you, I'm not Rowan."
You frown as her friend says, "Me either."

You walk away from the spirits.->Crowded Cafe]

The passage previous to this is "Enter Crowded Cafe", it allows you to reach "Rowan Spirit?". This passage is "Rowan Spirit?". If you click "Crowded Cafe", it gives you a menu that allows you to return to the passage "Rowan Spirit?".

The names aren't all that important, just the fact that you are revisiting the same passage.
How can I fix my code to remove the top portion of text and leave only the bottom portion of text if the player revisits the passage?

Comments

  • I solved this myself! Sorry to clog up the forum.
  • How did you solve it? If you were so kind to post your solution, maybe someone else can learn from it.
  • I used a code scripted by greyelf. After some more research, I found the code:
    (if: not ((history:) contains "qualifying passage"))[
    The passage's original description....
    ](else:)[
    The passage's replacement description.....
    ]
    (Above changes the text if you visit the same passage twice.)
    And the code:
    (set: $count to (count: (History:), "qualifying passage"))
    (if: $count is 0)[
    The passage's original description....
    ](else-if: $count is 1)[
    The passage's first replacement description, it appears after the Reader first visit to the "qualifying passage"
    ](else-if: $count is 2)[
    The passage's second replacement description, it appears after the Reader second visit to the "qualifying passage"
    ](else:)[
    The passage's third replacement description, it appears after the Reader has visit the "qualifying passage" three or more time.
    ]
    (Which works as the one above.)
  • Please use the C button in the Comment field's toolbar to wrap your code examples in a code tag, it makes it easier to find and read.

    eg. your example wrapped in a code tag.
    (if: not ((history:) contains "qualifying passage"))[
    The passage's original description....
    ](else:)[
    The passage's replacement description.....
    ]
    (Above changes the text if you visit the same passage twice.)
    And the code:
    (set: $count to (count: (History:), "qualifying passage"))
    (if: $count is 0)[
    The passage's original description....
    ](else-if: $count is 1)[
    The passage's first replacement description, it appears after the Reader first visit to the "qualifying passage"
    ](else-if: $count is 2)[
    The passage's second replacement description, it appears after the Reader second visit to the "qualifying passage"
    ](else:)[
    The passage's third replacement description, it appears after the Reader has visit the "qualifying passage" three or more time.
    ]
    
Sign In or Register to comment.