How to make a list of obtained endings [solved]

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
ebi-hime
Veteran
Posts: 401
Joined: Sat Aug 24, 2013 8:18 pm
Completed: Asphyxia, Blackberry Honey, The Language of Love, etc
Tumblr: ebi-hime
itch: ebihime
Contact:

How to make a list of obtained endings [solved]

#1 Post by ebi-hime »

Hello n_n
I've been working on an update for my very long, multi-ending VN, The Way We All Go. In this VN, I really need a list of completed endings available for the reader, since there are about 20 of them, and without the VN keeping track of which endings have been seen it can get confusing.

The code I was using to display the list of endings used to work when I was still using the 16.5 version of ren'py. The code I used was this:

Code: Select all

init python:
    
    # If persistent.endings is None (the first pass through the game), then make it a set.
    if persistent.endings is None:
        persistent.endings = set()

    # This shows a single ending, as necessary.
    def show_ending(number, name):
         if name in persistent.endings:
             ui.text("% 2d. %s" % (number, name))
         else:
             ui.text("% 2d. ---------------------------------" % (number,))
And then, for the screen with the multiple endings, I used this:

Code: Select all

screen endings:
    
    tag menu
    use navigation
    
    $ ui.vbox()
    $ show_ending(1, "Liar")
    $ show_ending(2, "Proof")

etc, etc
And, with each ending the player unlocked, there was this code:

Code: Select all

$ persistent.endings.add("Liar")
The code used to work just fine, and looked like this:
Image

But now, after updating ren'py to the newest version, it doesn't work anymore, and instead looks like this:
Image

And I didn't change the code, so I think it must be something about the update that has stopped it from working.
If anybody has any ideas, I would really appreciate it. I have no idea what could be wrong ;_;
Last edited by ebi-hime on Wed Nov 19, 2014 11:19 am, edited 1 time in total.
I have a lot of free & commercial VNs available on Steam and itchio.io if you want to check them out! ☆

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: How to make a list of obtained endings

#2 Post by Milkymalk »

It reads "8. Tomorrow" in the first and in the second picture. I don't see any problem there. Did you miss it because it's hardly visible against the checkerboard background?

Otherwise I don't understand what you mean. If you are mourning the absence of images in the picture, did you maybe change a path variable? Or moved the images to a different folder?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
ebi-hime
Veteran
Posts: 401
Joined: Sat Aug 24, 2013 8:18 pm
Completed: Asphyxia, Blackberry Honey, The Language of Love, etc
Tumblr: ebi-hime
itch: ebihime
Contact:

Re: How to make a list of obtained endings

#3 Post by ebi-hime »

Milkymalk wrote:It reads "8. Tomorrow" in the first and in the second picture. I don't see any problem there. Did you miss it because it's hardly visible against the checkerboard background?

Otherwise I don't understand what you mean. If you are mourning the absence of images in the picture, did you maybe change a path variable? Or moved the images to a different folder?
The endings still unlock properly, but the background no longer works properly (and I didn't delete the image file or move the image to a different folder) and the navigation at the bottom no longer works properly, either.
Actually, the imagemap that should have the navigation hotspots on it gets replaced with the image I'm using as the background of the screen, for some reason. And so it's impossible to return back to the main menu.

When I delete the piece of code that reads:

Code: Select all

$ ui.vbox()
then the navigation imagemap and the background start to work properly again, like they do in the first image, but the list of unlocked endings disappears, so I think it must be something about the vbox code that is messing it up...
I don't know why though...
I have a lot of free & commercial VNs available on Steam and itchio.io if you want to check them out! ☆

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: How to make a list of obtained endings

#4 Post by Milkymalk »

Then you should show the code of the parts that don't work too.

The background image is there, but it starts below the endings. My guess is that its code is somehow part of the vbox. You could use "add" to just display it as part of the screen instead of as background for the vbox.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
ebi-hime
Veteran
Posts: 401
Joined: Sat Aug 24, 2013 8:18 pm
Completed: Asphyxia, Blackberry Honey, The Language of Love, etc
Tumblr: ebi-hime
itch: ebihime
Contact:

Re: How to make a list of obtained endings

#5 Post by ebi-hime »

Milkymalk wrote:Then you should show the code of the parts that don't work too.

The background image is there, but it starts below the endings. My guess is that its code is somehow part of the vbox. You could use "add" to just display it as part of the screen instead of as background for the vbox.
I have it set up so ren'py should automatically use this image as a background image any time a screen is called:

Code: Select all

gm_root = "gabg.png",
which works on all the other screens just fine, so I don't know why it won't work on this one...
I tried to use your suggestion and put in

Code: Select all

add "gabg"
before the vbox code but it still doesn't work, it keeps doing the same thing.
I have a lot of free & commercial VNs available on Steam and itchio.io if you want to check them out! ☆

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: How to make a list of obtained endings

#6 Post by Donmai »

After updating Ren'Py, suddenly I had similar problems with my code. For example, on my music room all the buttons were suddenly falling one on top of the other. The code I was using to show the buttons was very old:

Code: Select all

        ui.vbox(xalign=0.02, ypos=16) 
        music_button("Cloudscape", "bgm/cloudscape.OGG")
        music_button("Slumberland Jam", "bgm/slumberland jam.OGG")
        # and so on...
To make the music room work again I had to change to the new music room code, that uses screen language:

Code: Select all

    vbox:
        xalign 0.02
        ypos 16
        textbutton "Cloudscape" action mr.Play("bgm/cloudscape.OGG")
        textbutton "Slumberland Jam" action mr.Play("bgm/slumberland jam.OGG")
        # and so on...
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
ebi-hime
Veteran
Posts: 401
Joined: Sat Aug 24, 2013 8:18 pm
Completed: Asphyxia, Blackberry Honey, The Language of Love, etc
Tumblr: ebi-hime
itch: ebihime
Contact:

Re: How to make a list of obtained endings

#7 Post by ebi-hime »

Donmai wrote:After updating Ren'Py, suddenly I had similar problems with my code. For example, on my music room all the buttons were suddenly falling one on top of the other. The code I was using to show the buttons was very old:

Code: Select all

        ui.vbox(xalign=0.02, ypos=16) 
        music_button("Cloudscape", "bgm/cloudscape.OGG")
        music_button("Slumberland Jam", "bgm/slumberland jam.OGG")
        # and so on...
To make the music room work again I had to change to the new music room code, that uses screen language:

Code: Select all

    vbox:
        xalign 0.02
        ypos 16
        textbutton "Cloudscape" action mr.Play("bgm/cloudscape.OGG")
        textbutton "Slumberland Jam" action mr.Play("bgm/slumberland jam.OGG")
        # and so on...
Ah, thank you. The code I was using was pretty ancient too, so that's probably why it's stopped working. I guess the new ren'py doesn't like the ui.vbox code haha
But... the old code I had was so easy...
I wonder how to rewrite it... I'm not entirely sure :'/
I have a lot of free & commercial VNs available on Steam and itchio.io if you want to check them out! ☆

User avatar
ArachneJericho
Regular
Posts: 196
Joined: Sun Jun 22, 2014 2:04 am
Projects: Kaguya Hime
Tumblr: mousedeerproductions
Location: Seattle, WA, USA
Contact:

Re: How to make a list of obtained endings

#8 Post by ArachneJericho »

Try this code in your screens.rpy:

Code: Select all

screen endings:
    tag menu
    use navigation

    $ all_endings = [(1, "Liar"), (2, "Proof")]

    vbox:
        for ending in all_endings:
            $ ending_number = ending[0]
            $ ending_name = ending[1]
            $ ending_string = "% 2d. ---------------------------------" % (ending_number,))
            if ending_name in persistent.endings:
                $ ending_string = "% 2d. %s" % (ending_number, ending_name)
            text ending_string

User avatar
ebi-hime
Veteran
Posts: 401
Joined: Sat Aug 24, 2013 8:18 pm
Completed: Asphyxia, Blackberry Honey, The Language of Love, etc
Tumblr: ebi-hime
itch: ebihime
Contact:

Re: How to make a list of obtained endings

#9 Post by ebi-hime »

ArachneJericho wrote:Try this code in your screens.rpy:

Code: Select all

screen endings:
    tag menu
    use navigation

    $ all_endings = [(1, "Liar"), (2, "Proof")]

    vbox:
        for ending in all_endings:
            $ ending_number = ending[0]
            $ ending_name = ending[1]
            $ ending_string = "% 2d. ---------------------------------" % (ending_number,))
            if ending_name in persistent.endings:
                $ ending_string = "% 2d. %s" % (ending_number, ending_name)
            text ending_string

Ah, it works!!! Finally!!!
Thank you so much! I really appreciate it n__n;;
I have a lot of free & commercial VNs available on Steam and itchio.io if you want to check them out! ☆

User avatar
ArachneJericho
Regular
Posts: 196
Joined: Sun Jun 22, 2014 2:04 am
Projects: Kaguya Hime
Tumblr: mousedeerproductions
Location: Seattle, WA, USA
Contact:

Re: How to make a list of obtained endings [solved]

#10 Post by ArachneJericho »

You're very welcome!

Post Reply

Who is online

Users browsing this forum: Baidu [Spider]