Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
-
That Oyajicon
- Regular
- Posts: 33
- Joined: Sun May 29, 2016 7:31 pm
- Location: The Pillars of Nosgoth
-
Contact:
#1
Post
by That Oyajicon » Wed May 03, 2017 2:32 pm
I'm working on a simple game to teach myself the basics of Ren'Py, and I decided to learn stat management by doing a short quiz, and giving a different response based on how well the player scored.
Code: Select all
"Alright, the quiz is done, now it's time to see how you did."
if QP == 5:
"Holy smokes, you got 'em all right! Good for you!"
else:
if QP == 4:
"Hmm, looks like you missed just one, that's not too bad."
else:
if QP == 3:
"Well, three out of five isn't AWUL, ya know..."
else:
if QP => 1:
"Seriously? You got less than half of these right?"
else:
"You...got zero right? How????"
"Well, anyway, now that we're all done with that, let's experiment a bit more..."
I'm getting an error when I try to run the code. Specifically, Ren'Py's telling me that the last three lines are where the problem lies. Anyone here who could point me in the right direction?
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#2
Post
by Imperf3kt » Wed May 03, 2017 2:53 pm
Your problem is indentation and your incorrect use of conditionals. You don't actually require an
else for this.
=> 1 is the wrong way around also. Additionally I fixed a typo (AWUL > awful, with italics)
Try this instead:
Code: Select all
"Alright, the quiz is done, now it's time to see how you did."
if QP == 5:
"Holy smokes, you got 'em all right! Good for you!"
elif QP == 4:
"Hmm, looks like you missed just one, that's not too bad."
elif QP == 3:
"Well, three out of five isn't {i}awful{/i}, ya know..."
elif QP >= 1:
"Seriously? You got less than half of these right?"
else:
"You... got zero right? How????"
"Well, anyway, now that we're all done with that, let's experiment a bit more..."
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
That Oyajicon
- Regular
- Posts: 33
- Joined: Sun May 29, 2016 7:31 pm
- Location: The Pillars of Nosgoth
-
Contact:
#3
Post
by That Oyajicon » Wed May 03, 2017 3:17 pm
Oh, thanks a ton! The tutorial videos I'd been following didn't mention using elif, so that really helps me out.
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#4
Post
by Imperf3kt » Wed May 03, 2017 3:20 pm
As a suggestion, check the upload date on tutorials in future. Try to avoid anything from before around November last year.
Oh, and there may still be an indentation issue. I forgot to remove the indentation on the conditionals, you'd probably want them at the same level as the first line of dialogue.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
That Oyajicon
- Regular
- Posts: 33
- Joined: Sun May 29, 2016 7:31 pm
- Location: The Pillars of Nosgoth
-
Contact:
#5
Post
by That Oyajicon » Wed May 03, 2017 5:15 pm
Yeah, that's pretty much what I've experienced. It's gotten to the point where even simple stuff like this:
Code: Select all
show p1 at right
jp "Puff?"
show p1:
at xalign 0.5 yalign 0.5
jp "Puff?"
jp "Puff, puff?"
"Hmm..."
Is throwing up errors, and it's a little frustrating trying to figure out why. (For the record, it's the xalign/yalign bit that's apparently missing something at the end of the line, but I'm not sure how to figure out
what's missing.)
-
Divona
- Miko-Class Veteran
- Posts: 678
- Joined: Sun Jun 05, 2016 8:29 pm
- Completed: The Falconers: Moonlight
- Organization: Bionic Penguin
- itch: bionicpenguin
-
Contact:
#6
Post
by Divona » Wed May 03, 2017 11:03 pm
You don't need "at" for ATL, unless it's transform.
Code: Select all
show p1 at right
jp "Puff?"
show p1:
xalign 0.5 yalign 0.5
jp "Puff?"
jp "Puff, puff?"
"Hmm..."
Completed:

-
That Oyajicon
- Regular
- Posts: 33
- Joined: Sun May 29, 2016 7:31 pm
- Location: The Pillars of Nosgoth
-
Contact:
#7
Post
by That Oyajicon » Thu May 04, 2017 9:00 pm
Okay, thanks!
Users browsing this forum: No registered users