Apologies if this has been asked before, but if it has I can't find it.
So, what I'm trying to do is assign a score that starts at 0, goes up (and potentially down) depending on which choices the player makes, and then at certain points in the story what happens next depends on how the score compares to other numbers. My eventual goal is to have several such scores that get compared to each other to judge what the player is prioritizing. But I don't know the right code to make even a single score work.
What I have now is this before the start:
default score = 0
And this after the player makes a choice that will increase the score:
$ score += 1
And this when I want to check the score:
if score < 0:
"You scored some points!"
else:
"You didn't score any points!"
But when I playtest the game, it gives me the "You didn't score any points!" text even when I made the choice to increase the score. Can someone explain what I'm doing wrong? I know very little Python so please state your answer as simply as possible.
How to keep/check a score?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Re: How to keep/check a score?
You probably forgot the = sign after the <. This should fix it:
Also, I think you can just use this as the code for the beginning (after the label start), not sure how the default one works.
Code: Select all
if score <= 0:
"You scored some points!"
else:
"You didn't score any points!"
Code: Select all
$ score = 0
Re: How to keep/check a score?
I tried choosing the option that didn't gain points, and it gave me the "You scored some points!" result. Only then did I realize I had mixed up < and >!
I feel foolish = True
I feel foolish = True
Who is online
Users browsing this forum: Google [Bot]