[SOLVED] switch between NVL and ADV menus: how does it work?

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
mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

[SOLVED] switch between NVL and ADV menus: how does it work?

#1 Post by mjshi » Tue Mar 26, 2013 11:12 am

PyTom wrote:Hm... probably the easiest way to do this would be to take the normal menu, and restyle it using the style system. You can then do something like:

Code: Select all

init python:
    adv_menu = menu
    use_nvl_menu = False

    def menu(*args, **kwargs):
        if use_nvl_menu:
             return nvl_menu(*args, **kwargs)
        else:
             return adv_menu(*args, **kwargs)
I searched up how to switch between nvl and adv menus, and got this.
Since I am pretty new to programming, I ask the following questions:
How does this work and how would you be able to actually use them in the script? And, where are you supposed to place this in- what's a style system?
What if you wanted to use BOTH ADV and NVL style menus?
Last edited by mjshi on Fri Mar 29, 2013 12:23 am, edited 1 time in total.

User avatar
arachni42
Veteran
Posts: 341
Joined: Mon Feb 25, 2013 6:33 pm
Organization: no, I'm pretty messy
Location: New York
Contact:

Re: switch between NVL and ADV menus: how does it work?

#2 Post by arachni42 » Thu Mar 28, 2013 9:08 pm

mjshi wrote: How does this work and how would you be able to actually use them in the script? And, where are you supposed to place this in- what's a style system?
What if you wanted to use BOTH ADV and NVL style menus?
A style system is just a way that Ren'Py keeps track of how everything is supposed to look. So, basically the NVL style is the thing that tells Ren'Py that text is supposed to go on a large screen and that the menus look like links instead of buttons. The style system is built to have stuff work without having to change anything, but it also lets you make your own and give them your own name.

I was able to switch menus in my prologue by doing the following.

First, before the introduction text, I put this:

Code: Select all

$ adv_menu = menu
Here I am creating a new variable called "adv_menu". I set it equal to "menu," because by default, "menu" has the adv style. I am storing it in "adv_menu" for safekeeping. You can put this in your script anywhere as long as it's before you start switching menus. I have it right before the first line of my prologue.
As a note, I am not creating a variable "nvl_menu", because that one is already there!

Now, whenever I wanted to use a NVL menu, I did this right before the menu:

Code: Select all

$ menu=nvl_menu
"nvl_menu" has all of the styles of the NVL style menu, so I am telling Ren'Py, "Hey, take the menu and use these."
That's all fine and dandy, but how do I switch back?

Code: Select all

$ menu=adv_menu
This is why I stored the ADV style menu in a variable called "adv_menu". Here I am telling Ren'Py to take the menu and use those. I was basically able to flip back and forth between menus by using the line "$ menu=nvl_menu" or "$ menu=adv_menu" whenever I wanted to switch.
I, Miku (NaNoRenO 2014)
Vignettes (NaNoRenO 2013)
_________________

User avatar
mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: [SOLVED] switch between NVL and ADV menus: how does it w

#3 Post by mjshi » Fri Mar 29, 2013 12:25 am

@ arachni42: Thanks, once again your answers are clear, concise, and easily understandable. It'll be a hassle to have to insert them every single time there's a switch but it'll be well worth it. So thanks again!

Post Reply

Who is online

Users browsing this forum: No registered users