Customizable Menus

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
Vulpinoid
Newbie
Posts: 4
Joined: Sat Jan 24, 2015 10:24 pm
Deviantart: vulpinoid
Contact:

Customizable Menus

#1 Post by Vulpinoid »

Hi everyone, I'm new around here.

I've been digging into Ren'Py for the last week or so, and it's been a lot of fun developing a storytelling engine for an open narrative sandbox game.

Basically the kind of game where you can do a range of things within the setting, including eating, sleeping, talking to people, and gradually picking up the clues for a story that is unfolding in the background.

I don't know if anyone has already worked this out, but is it possible to create a menu that populates it's entries based on the inventory or location of the main character?

For example:
-Go Shopping (only appears in the menu if the character is in a location with a shop)
-Eat (only appears in the menu if the character is carrying food)
-Take Medicine (only appears in the menu if the character is carrying medicine)
-Move (available any time)
-Sleep (available any time)

So far, I've used my javascript and php knowledge to get most things to work in the game I'm designing, but most of my tricks just don't seem to be working for this. The best way I've managed to accomplish it is by creating a couple of variable comparisons, then diverting the program to different complete menus (is there a shop? Head to the menus in group "A"...is there food available? Select the second subset of menus from that group...is there medicine available?...head to the first menu in that second subset of group "A". It's messy, and it means I have to develop 8 separate menus (with 3 binary choices) but it works.

It'd be much easier if there was some way to turn on (or off) menu choices based on current character circumstances.

If someone has already worked out how to do it, simply pointing me to the right threads or cookbook examples would be great.

Thanks.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Customizable Menus

#2 Post by philat »

Is there any reason you couldn't just use conditionals on the menu choices?

Code: Select all

menu:
    "Go shopping" if location_has_shop:
        "blahblah"
    "Eat" if has_food:
        "blah"
I mean, you'd have to set up a system to track the variables efficiently (and in the case of an inventory system that can be pretty complicated depending on how you do it) but... the basic mechanism seems simple.

Vulpinoid
Newbie
Posts: 4
Joined: Sat Jan 24, 2015 10:24 pm
Deviantart: vulpinoid
Contact:

Re: Customizable Menus

#3 Post by Vulpinoid »

That might be exactly what I'm after...seems too simple, that's probably why I didn't go in that direction, I was looking for something complicated.

I'll give it a try.

Thank-you.

Post Reply

Who is online

Users browsing this forum: No registered users