+1 vote
by (240 points)
edited by
[[1|Bad][$wrong += 1]]

[[2|Not bad][$wrong += 1]]

[[3|Good][$score += 2]]

[[4|Quite good][$score += 1]]

[[5|Very good][$score += 1]]

<<if $score is 6>>\
<<elseif $score is 5>>\
Not great!

<<if $wrong gt 1>>\
Doing bad!

<<if $hyper is 1>>\
Not bad!

<<print $wrong>>
<<print $score>>

I have created a story, I edited out the content and put this in it. If they were to go through the story, there would be 3 questions. If they score the right answer they get 2 points, for a total of 6. Close to the correct answer, then 1 point, and if incorrect they would get 1 point in the wrong variable.

If they get something wrong, it would take them to a passage to teach them some stuff. I have another check variable for after each question to make sure they don't repeat the Q or get stuck in a loop.

What I am basically trying to say is that my variables have been working in my story. But at some point its not working anymore at the end. The end screen I have created if functions where a message would appear depending on their score. But for $score, only the <<else>> is printed even if you get the max score (6 pts). And if you get any Qs wrong so you increase your $wrong value, the message for it doesn't show either. This doesn't make sense since if $wrong does not = 0 they were taken to a learning passage, yet at the end screen it doesn't show the message.

To also test this out, I wanted to print the 2 variables out to check if the numbers were right but it doesn't print anything. Just an empty space.

I had this working few days ago, so I don't know what is wrong! If anyone can tell me what happened it would be most appreciated!

Edit: I forgot to add, I do have a "StoryInit" passage where I set all my variables to 0. I also tested printing $checkpointH and that works, other variables wont print out.

1 Answer

0 votes
by (64.2k points)
Nothing is obviously wrong with what you've shown.  Short of seeing the actual code, I'm unsure what anyone will be able to do for you.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.