Menu change problem ? / 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
Kindynos
Newbie
Posts: 23
Joined: Wed Feb 06, 2013 10:42 pm
Projects: Artist's Heart
Location: Santiago, Chile
Contact:

Menu change problem ? / solved

#1 Post by Kindynos »

So a while back I made a post about having my menu change it's image and music after a certain amount of time. Turns out that the code that was given to me worked for a while, until I changed the time for it, and now it doesn't work. Truly, I'd like to fix it, any help?

The code I have in my script is

Code: Select all

image bg alternative_menu = "Menu2.png"
image bg menu_base = "Menu1.png"

init:
    $ mm_change = False

label main_menu:
    if mm_change:
        scene bg alternative_menu
        play music "Second title.mp3"
    else:
        scene bg menu_base
        play music "First title.mp3"
    show screen mm_timer(length=60.0)
    call screen main_menu

label main_menu_change:
    $ mm_change = True
    jump main_menu
And I have this one in screens

Code: Select all

screen mm_timer:
    timer length action Jump("main_menu_change")
Any help on how to fix it? Thank you!
Last edited by Kindynos on Fri Mar 07, 2014 1:09 pm, edited 1 time in total.
I'm probably the most nervous game maker you'll find, it's a fact

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Menu change problem ?

#2 Post by Asceai »

Works fine for me. How does it not work for you, exactly?

Are you certain the only change you made was to change 'length' to 60.0; nothing else happened? And it worked fine immediately before that change and broke immediately after?

User avatar
Kindynos
Newbie
Posts: 23
Joined: Wed Feb 06, 2013 10:42 pm
Projects: Artist's Heart
Location: Santiago, Chile
Contact:

Re: Menu change problem ?

#3 Post by Kindynos »

I changed it previously to another number (A higher one) and it seems that after that it doesn't work.
I now try testing it putting it at around 10 seconds and nothing, I'm not really sure if it'll only work with just 60 seconds- The idea is for it to change after a rather long time, after all.
I'm probably the most nervous game maker you'll find, it's a fact

bg_nocturnal
Regular
Posts: 25
Joined: Thu Feb 13, 2014 9:45 am
Contact:

Re: Menu change problem ?

#4 Post by bg_nocturnal »

Are you task-switching while you wait to see if it works, by any chance?
I seem to remember having a few issues related to timers and alt+tab awhile back.

User avatar
Kindynos
Newbie
Posts: 23
Joined: Wed Feb 06, 2013 10:42 pm
Projects: Artist's Heart
Location: Santiago, Chile
Contact:

Re: Menu change problem ?

#5 Post by Kindynos »

Nope, I know that task switching makes it not work- and I'm not, sadly!! (I really wish that was the problem)
I'm now putting it at 5 secs so I evade task switching, but I've waited the minute again and nothing, sadly.
I'm probably the most nervous game maker you'll find, it's a fact

bg_nocturnal
Regular
Posts: 25
Joined: Thu Feb 13, 2014 9:45 am
Contact:

Re: Menu change problem ?

#6 Post by bg_nocturnal »

Okay, next theory: Have you changed your game's theme since you implemented the code?

When I ran it, at first there were no visible changes, because my theme has a solid background for its main menu. Check the value of mm_root in options.rpy. It should be something like "#0000" or "#00000000" for you to see the background images that you're setting. Maybe something changed it?

When I fixed that value, the code worked fine for me too.

Another thing I can suggest is to make sure you're using the latest version of Ren'Py. Maybe it's a problem in a previous version that has been solved since? If that doesn't help and there are no other ideas, we can try doing the same thing with different code.

User avatar
Kindynos
Newbie
Posts: 23
Joined: Wed Feb 06, 2013 10:42 pm
Projects: Artist's Heart
Location: Santiago, Chile
Contact:

Re: Menu change problem ?

#7 Post by Kindynos »

Mm I haven't, really.

I just did so and it's all the same, the thing is- not even the music changes, and I set the music with that code, actually! So it's really weird! I just tried with the #000000 thing and nope, it's not working.

Truly I think I might need to use another code ;; I've been curious to know if there is actually another one..
I'm probably the most nervous game maker you'll find, it's a fact

bg_nocturnal
Regular
Posts: 25
Joined: Thu Feb 13, 2014 9:45 am
Contact:

Re: Menu change problem ?

#8 Post by bg_nocturnal »

Sorry for the delay, I've been quite busy these past few days.
Here's pretty much the same code, doing the same things in a slightly different way:

Code: Select all

image bg menu_base = ConditionSwitch(
    "mm_original", "Menu1.png",
    "True", "Menu2.png")

init:
    $ mm_original = True
    $ mm_stay = 60.0

label main_menu:
    scene bg menu_base
    play music "First title.mp3"
    show screen mm_timer
    call screen main_menu

Code: Select all

screen mm_timer:
    timer mm_stay action [SetVariable("mm_original", False), Play("music", "Second title.mp3")]
As you can see, the timing for the change to the alternative menu is now controlled by the mm_stay variable and the second music track is set from inside the mm_timer screen.

Replace the snippets you've shown us with these, and hopefully that takes care of the issue somehow. If not, we can add some signals here and there to shed light on what exactly is going wrong.

User avatar
Kindynos
Newbie
Posts: 23
Joined: Wed Feb 06, 2013 10:42 pm
Projects: Artist's Heart
Location: Santiago, Chile
Contact:

Re: Menu change problem ?

#9 Post by Kindynos »

!! That helped!!

//also ren'py had an update 3 days ago (and just after I checked myself if there was one OTL)

Thank you so much!!!
I'm probably the most nervous game maker you'll find, it's a fact

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]