Point-Based Endings

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.
Post Reply
Message
Author
User avatar
VaanAshe
Regular
Posts: 30
Joined: Mon Aug 18, 2008 5:39 pm
Projects: Halcyon High
Location: England
Contact:

Point-Based Endings

#1 Post by VaanAshe » Tue Aug 19, 2008 6:48 pm

Forgive me for asking what is probably a real n00bish question, but I'm having a little trouble with this. I actually want to work the system so that it's like a dating system (with three characters, where the ending results with which girl the main character is paired up with depending on who has the highest points).

I tried editing it around, and got an error message. So, instead, I thought I'd try copy and pasting exactly what is on the page and seeing what actually happens. In fact, I got the same error message. I've copied exactly what is in the above link, no changes and nothing added and all that.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


On line 18 of D:\Users\BTK\Documents\renpy-6.6.3\Feather/game/script.rpy: if statement expects a non-empty block.
if winners == [0]:
                  ^

On line 20 of D:\Users\BTK\Documents\renpy-6.6.3\Feather/game/script.rpy: elif clause must be associated with an if statement.
elif winners == [1]:
    ^

On line 22 of D:\Users\BTK\Documents\renpy-6.6.3\Feather/game/script.rpy: elif clause must be associated with an if statement.
elif winners == [2]:
    ^

On line 24 of D:\Users\BTK\Documents\renpy-6.6.3\Feather/game/script.rpy: elif clause must be associated with an if statement.
elif winners == [3]:
    ^
As such, the error continues on to include each and every single "elif" statement there. Sorry if this is incredibly obvious as to what the problem is.

(As a minor side-note, considering I've not done this before, how would I go about increasing the values of each attribute as well? And, on a similar note, can the points go below 0, or does it stop at 0?)
LiveJournal and [url=http://myrrh_tree.livejournal.com/]Reviews[/url]... I has them

User avatar
N0UGHTS
Miko-Class Veteran
Posts: 516
Joined: Mon Jul 28, 2008 7:47 pm
Location: California, USA
Contact:

Re: Point-Based Endings

#2 Post by N0UGHTS » Tue Aug 19, 2008 7:05 pm

VaanAshe wrote:I've copied exactly what is in the above link, no changes and nothing added and all that.
So does every elif and if block in your script only contain only the elif line and a comment line? If that's the case, that explains the traceback saying that Ren'Py expects a non-empty block; Ren'Py (and pretty much any other programming language with comment lines) ignore comment lines and go straight for lines relevant to the scripting itself.
World Community Grid
"Thanksgiving is a day for Americans to remember that family is what really matters.
"The day after Thanksgiving is when Americans forget that and go shopping." —Jon Stewart
Thank you for playing Alter Ego. You have died.

User avatar
VaanAshe
Regular
Posts: 30
Joined: Mon Aug 18, 2008 5:39 pm
Projects: Halcyon High
Location: England
Contact:

Re: Point-Based Endings

#3 Post by VaanAshe » Tue Aug 19, 2008 7:14 pm

N0UGHTS wrote:
VaanAshe wrote:I've copied exactly what is in the above link, no changes and nothing added and all that.
So does every elif and if block in your script only contain only the elif line and a comment line? If that's the case, that explains the traceback saying that Ren'Py expects a non-empty block; Ren'Py (and pretty much any other programming language with comment lines) ignore comment lines and go straight for lines relevant to the scripting itself.
...oh...*sweatdrop* I knew that...

So basically, it can't find something to display if the if statement is true, right?

...oh god, I feel so stupid. ;_;

EDIT: Aya...that was obvious...Sorry! ;_;

EDIT: Okay, I've got that sorted out. Sorry about that! I really should think before I post... ;_;

EDIT...AGAIN: Saying that, I have no clue on how to increase the values. I've tried "$ strength_points = +2", but it just changes the value to 2, rather than increase it by two. ...help?
LiveJournal and [url=http://myrrh_tree.livejournal.com/]Reviews[/url]... I has them

User avatar
N0UGHTS
Miko-Class Veteran
Posts: 516
Joined: Mon Jul 28, 2008 7:47 pm
Location: California, USA
Contact:

Re: Point-Based Endings

#4 Post by N0UGHTS » Tue Aug 19, 2008 7:36 pm

The = sign is equivalent to "is" or "becomes" in the English language. So you're effectively telling Ren'Py "After spending four hours at the gym, the protagonist's strength is now 2 (positive) points worth!"

Just make it "$ strength_points + 2".
World Community Grid
"Thanksgiving is a day for Americans to remember that family is what really matters.
"The day after Thanksgiving is when Americans forget that and go shopping." —Jon Stewart
Thank you for playing Alter Ego. You have died.

User avatar
VaanAshe
Regular
Posts: 30
Joined: Mon Aug 18, 2008 5:39 pm
Projects: Halcyon High
Location: England
Contact:

Re: Point-Based Endings

#5 Post by VaanAshe » Tue Aug 19, 2008 7:39 pm

N0UGHTS wrote:The = sign is equivalent to "is" or "becomes" in the English language. So you're effectively telling Ren'Py "After spending four hours at the gym, the protagonist's strength is now 2 (positive) points worth!"

Just make it "$ strength_points + 2".
As such, I've added the following:

Code: Select all

    "yes"
    $ strength_points + 2
    $ wisdom_points + 1

    "no"
    $ wisdom_points + 2
(Ignore my random "Yes" and "No" =P) It's telling me that strength and wisdom are equal, despite the fact that wisdom should be one point higher. ;_;
LiveJournal and [url=http://myrrh_tree.livejournal.com/]Reviews[/url]... I has them

User avatar
PyTom
Ren'Py Creator
Posts: 15469
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Point-Based Endings

#6 Post by PyTom » Tue Aug 19, 2008 9:09 pm

Actually, you want something like:

$ strength = strength + 2

or the equivalent and shorter

$ strength += 2

Just having a + alone makes Ren'Py (really, Python) do the calculation, but then not store it anywhere.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
VaanAshe
Regular
Posts: 30
Joined: Mon Aug 18, 2008 5:39 pm
Projects: Halcyon High
Location: England
Contact:

Re: Point-Based Endings

#7 Post by VaanAshe » Tue Aug 19, 2008 9:16 pm

...if this was MSN, I'd flood this post with pictures of foxes, but I can't. In which case, I'll just say THANK YOU VERY MUCH! =D
LiveJournal and [url=http://myrrh_tree.livejournal.com/]Reviews[/url]... I has them

Post Reply

Who is online

Users browsing this forum: abysswatcher, Bing [Bot]