Page 1 of 1

How to make a list of obtained endings [solved]

Posted: Mon Nov 17, 2014 6:16 pm
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 ;_;

Re: How to make a list of obtained endings

Posted: Mon Nov 17, 2014 9:32 pm
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?

Re: How to make a list of obtained endings

Posted: Mon Nov 17, 2014 9:49 pm
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...

Re: How to make a list of obtained endings

Posted: Mon Nov 17, 2014 11:21 pm
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.

Re: How to make a list of obtained endings

Posted: Tue Nov 18, 2014 4:35 am
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.

Re: How to make a list of obtained endings

Posted: Tue Nov 18, 2014 6:50 pm
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...

Re: How to make a list of obtained endings

Posted: Tue Nov 18, 2014 7:41 pm
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 :'/

Re: How to make a list of obtained endings

Posted: Wed Nov 19, 2014 1:47 am
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

Re: How to make a list of obtained endings

Posted: Wed Nov 19, 2014 11:19 am
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;;

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

Posted: Wed Nov 19, 2014 11:37 am
by ArachneJericho
You're very welcome!