A list of 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
Smobey

A list of endings

#1 Post by Smobey » Wed Nov 12, 2008 4:04 pm

Well, what I basically want is a list of endings seen that you can access through the main menu. I can create the button in the main menu and such alright, but basically, I have two questions:

1. I want that the actual names of the endings aren't visible until you've gotten them. How do I do this?
2. I have an overlay with the character's status and various menu buttons, showing them all at the bottom of the screen. It wouldn't be good if you could see them in the ending list screen. How would I go about making them invisible?

Thanks for your advice.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: A list of endings

#2 Post by PyTom » Wed Nov 12, 2008 4:20 pm

Do you want a list of endings, or do you want the endings to be buttons that, when pressed, bring the user to that ending?
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
EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: A list of endings

#3 Post by EvilDragon » Wed Nov 12, 2008 7:49 pm

I think he needs only text names, which will be shown only after the player got the certain ending. Like in Tsukihime, for example.
Angels of paradise, angels of sacrifice
Please let me be under your wings...

Smobey

Re: A list of endings

#4 Post by Smobey » Wed Nov 12, 2008 8:02 pm

I was thinking about the buttons at first, but simple text would probably be better. I intend to list all the bad endings too, so it's a pretty long list, probably spanning multiple pages.

Oh, and I figured out how to hide the overlays and such by myself.

Basically, what I want, would be something like...

ENDINGS:

???
???
???
???
???
???
???
???
???
???

-> To page 2
-> Return to title

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: A list of endings

#5 Post by PyTom » Wed Nov 12, 2008 9:00 pm

First, the common code. Since I'm lazy, I put the code to display an ending in a function, and call that repeatedly.

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,))

    # Add a button that brings people to the ending list to the main menu.
    config.main_menu.insert(2, ("Endings", "endings_1", "True"))

# Jump here to return to the main menu.
label endings_return:
      return
The code for the first ending list pages.

Code: Select all

label endings_1:
    scene bg endings_1
    $ ui.vbox()
    $ show_ending(1, "True Ending")
    $ show_ending(2, "False Ending")
    $ show_ending(3, "Best Ending")
    # ...
    $ show_ending(12, "Etcetera.")
    
    # $ ui.textbutton("Previous Page", clicked=ui.jumps("endings_0")
    $ ui.textbutton("Next Page", clicked=ui.jumps("endings_2")
    $ ui.textbutton("Return", clicked=ui.jumps("endings_return")
    $ ui.close()
     
    $ ui.interact(suppress_overlay=True)  
Finally, this code would have to occur at each ending.

Code: Select all

label true_ending:
    $ persistent.endings.add("True Ending")
    ".:. True Ending"
    return
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
Formedras
Regular
Posts: 40
Joined: Sat Oct 04, 2008 3:11 am
Projects: Ninja TK
Contact:

Re: A list of endings

#6 Post by Formedras » Thu Nov 13, 2008 2:43 am

I would think that the main label, having so many Python calls, should be replaced with a label that just calls a Python routine giving those commands. (Also... the ui.interact line at the end is improperly indented, which will give an error. I expect that PyTom is going to edit that as soon as he finds out.)
(EDIT: It was indentation, not justification. Also, PyTom did fix it.)

Also, if there's a way to give dynamic text or string variables in standard menus, perhaps that would be an easier and safer way to do it. Personally, that's one thing I wanted to do with one of my projects. There could be a multi-choice menu, with one or more having a string variable for a weapon name, such as "Pick Up Dead Guy's Sword". I'd been getting errors, but that was before I was getting string declarations in script correct in the first place.
The way this one would work would be to set up a series of if statements that would set string variables for the ending names to either the ending's name or "???". After that, call a menu using those variables instead of just the ending's names. At the end of each page, give the Next Page, Prev Page, and Main Menu options.

Alternatively, you could use the Menu If. For each ending, there would be two lines in the menu. One would be if the ending was gotten, and one would be if the ending hasn't yet been.

Of course, if you decide to use graphical menus, everything I just typed is moot, except possibly the first paragraph. The best way is through Python.

Oh, and could someone tell me whether this reply was actually usable? I don't mean "Someone took it and implemented it," but rather "This makes sense, I could do this simple enough." Thanks. I'd like to know whether or not I'm making an impact when I post or if I just crater myself.
Last edited by Formedras on Sat Nov 15, 2008 2:35 am, edited 2 times in total.
http://www.google.com/profiles/tizalka
Current Project:
Ninja TK

Guest

Re: A list of endings

#7 Post by Guest » Thu Nov 13, 2008 6:55 am

Thanks PyTom, that worked well for me. There was something wonky with the buttons, but I brutalized it a bit and got it working.

Formedras, I understood that only partly. I'm not familiar with Ren'Py yet at all, and all the python is gonna take some time to get used to. Though, the menu if part made sense, and I would have probably made it that way if not for PyTom.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot, Sergei Falcon