Changing main menu image through a variable: Is it possible?

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
CaesMRaenes
Regular
Posts: 132
Joined: Wed Aug 19, 2009 12:42 am
Projects: 軽い夏, The Aces
Contact:

Changing main menu image through a variable: Is it possible?

#1 Post by CaesMRaenes »

I was curious. Is it possible to change the main menu image when a certain point of the story is passed? An example I noticed of this is if a person had played through Umineko Ep. 1 completely and the main menu image changes or if a person completes Fate/Stay and it changes to a brighter image.

What I was hoping to try out is having the main menu image change after each chapter was done. And each chapter, as well as the button, would be unlocked when the reader finishes a chapter.

To put it simpler:
1. Prologue
2. Finished chapter so return to main menu
3. The main menu image is changed
4. Chapter 1 appears and is available to click

Also, I don't remember the code for making another button appear to be clickable so if someone can help me with that too, that would be much appreciated.
a.k.a. DragonfaeryYume on dA
The Vault in the Sky (Dev Blog)

Projects:
WIP The Aces
WIP (Head Artist) 軽い夏: The Sun Will Shine Through (tentative title)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Changing main menu image through a variable: Is it possi

#2 Post by PyTom »

CaesMRaenes wrote:I was curious. Is it possible to change the main menu image when a certain point of the story is passed? An example I noticed of this is if a person had played through Umineko Ep. 1 completely and the main menu image changes or if a person completes Fate/Stay and it changes to a brighter image.
The answer is... not yet.

Oh, you can certainly do it with Ren'Py, using a layout. But that's overkill for something like this. I'm currently redoing the way people will design screens in Ren'Py, and when I'm done with that, things should work a bit more nicely.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

F.I.A
Miko-Class Veteran
Posts: 546
Joined: Wed Sep 21, 2005 10:49 pm
Projects: Winter Shard, EVE, Hyperion
Contact:

Re: Changing main menu image through a variable: Is it possi

#3 Post by F.I.A »

CaesMRaenes wrote:I was curious. Is it possible to change the main menu image when a certain point of the story is passed? An example I noticed of this is if a person had played through Umineko Ep. 1 completely and the main menu image changes or if a person completes Fate/Stay and it changes to a brighter image.

What I was hoping to try out is having the main menu image change after each chapter was done. And each chapter, as well as the button, would be unlocked when the reader finishes a chapter.

To put it simpler:
1. Prologue
2. Finished chapter so return to main menu
3. The main menu image is changed
4. Chapter 1 appears and is available to click

Also, I don't remember the code for making another button appear to be clickable so if someone can help me with that too, that would be much appreciated.
Don't think it is workable with a variable, but a persistent will do.

Extracted from EVE, tested on 6.10.0a...

Code: Select all

# The first column is the persistent value and the second column is the images for the main menu. By giving a value to the persistent.ending, you can choose which image to be displayed.
    $    mm_root = ConditionSwitch(
            "persistent.ending == 3", "image03.png",
            "persistent.ending == 2", "image02.png",
            "persistent.ending == 1", "image01.png",
            "persistent.ending == 0", "image01.png",
            ),
「通りすがりのメーカだ。覚えとけ。」

----------
Winter shard
Image
WIP: Hyperion(Trace unknown), ?????(Progressing)

CaesMRaenes
Regular
Posts: 132
Joined: Wed Aug 19, 2009 12:42 am
Projects: 軽い夏, The Aces
Contact:

Re: Changing main menu image through a variable: Is it possi

#4 Post by CaesMRaenes »

Pretty cool. Thanks for the code, F.I.A. :)

I also read over my initial post and noticed that I didn't clarify my second question so if anyone can help, much appreciated. I wanted to ask: was there a code to unlock another button on the main menu (unlocking a new chapter, in my case) much like the case of the CG Gallery?
a.k.a. DragonfaeryYume on dA
The Vault in the Sky (Dev Blog)

Projects:
WIP The Aces
WIP (Head Artist) 軽い夏: The Sun Will Shine Through (tentative title)

Mihara
Regular
Posts: 119
Joined: Thu Mar 11, 2010 2:52 pm
Contact:

Re: Changing main menu image through a variable: Is it possi

#5 Post by Mihara »

CaesMRaenes wrote:I also read over my initial post and noticed that I didn't clarify my second question so if anyone can help, much appreciated. I wanted to ask: was there a code to unlock another button on the main menu (unlocking a new chapter, in my case) much like the case of the CG Gallery?
Something like this works:

Code: Select all

init python:
    # To see the intro again...
    config.main_menu = [(u"Prologue", "prologue", "True", "persistent.seen_intro")] + config.main_menu

label start:
    if not persistent.seen_intro:
        call prologue
    call chapter1

label prologue:
    # Do whatever. When it's done: 
    $ persistent.seen_intro = True
    return

label chapter1:
    # That's where the actual story starts, and where you would start if you 'start game' after having seen the prologue.
    return

...etc. Using 'call' instead of 'jump' under the start label and 'return' in actual chapters may help dealing with a convoluted branching story too, as this lets you separate text from logic.

You may need a more complex menu definition line, possibly requiring you to redefine all buttons from scratch, but every button can be shown or hidden and working or not working depending on Python expressions, and 'persistent.variablename' is an expression which is not 'True' until the persistent variable is set.

Post Reply

Who is online

Users browsing this forum: No registered users