Howdy, Stranger!

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

Adding a score counter on Harlowe 1.2.2

I'm creating a multiple choice quiz, and I'd like tell the player how they scored at the end. Ideally, I'l have different passages, depending on how the player does. So I guess the question is twofold:

1. How do I set the counter to count correct answers?
- I did find some javascript in another thread that was for Twine 1.0, but I can't get it to work in this one.

2. How do I send them to the appropriate final passage, based on their correct answers? Examples:

1-2 out of 8: "What are you even doing here?"
3-4 out of 8: "You need to do some homework."
5-6 out of 8: "Not bad, but not perfect either."
7 out of 8: "Well done!"
8 out of 8: "Aced it!"

I'm pretty new to Twine and to Javascript, so any help would be greatly appreciated.

Answers

  • Hey :)

    To make a counter variable, just use a built-in Twine numeric variable that increases with any correct answer:

    To declare:
    (set:$counter to 1)

    To increase with a correct answer:
    (set:$counter to ($counter + 1))

    Then when you check, just have final text that is set according to the number of correct answers:

    (if:$num_correct is 8)[(set:$result to "Aced it!")]

    Et cetera...

    Then in your results passage, just display $result.
Sign In or Register to comment.