Changing the links on the Main Menu

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
kag_kins
Newbie
Posts: 24
Joined: Thu Dec 11, 2008 6:01 pm
Contact:

Changing the links on the Main Menu

#1 Post by kag_kins »

Okay, the newbie’s back again… I tried to look up how to do this stuff on the site, but I couldn’t find everything I needed, and a lot of it was confusing, so… help?

I want to change the stuff on my main menu. I know how to change the looks with the image map (sort of), but I want to change the actual links. I want to keep Load, Start, Quit, and Preferences, but I want to add About (which would lead to a screen with options to see about the game, about renpy, and about the company/creator), Extras (CG Gallery, a couple 'deleted scenes' from the game, probably a few other things, like character bios- and a lot of these would have conditions to unlock), and a Help that doesn’t lead to the site, but to a game help screen I’ll create.

I know how to do… none of this, basically. Help?

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Changing the links on the Main Menu

#2 Post by EvilDragon »

In options.rpy, do your main menu:

Code: Select all

config.main_menu = [
        (u"Start", "story1_ch0", "True"),
        (u"Continue", "_continue", "True", 'renpy.can_load("1")'),
        (u"Preferences", _intra_jumps("preferences_screen", "main_game_transition"), "True"),
        (u"Exit", ui.callsinnewcontext("quit_prompt"), "True")
        ]
This is example from my kinetic novel. Let me explain:

- you can add as much buttons as you need this way
- "story1_ch0" was something I did to clarify where the game starts (usually it would just be "start" instead)
- the second line, I conditioned the showing of this button by asking if there's a savegame file present. If not, the button will not be shown (this is when you run the game for the first time)
- so, you get it: first part is the name of the button, then second part is a link to it, and third is a condition under which the button is shown, otherwise it's hidden.

I know it's not using imagemaps, I actually haven't dabbled with them, this works just fine for me.
Angels of paradise, angels of sacrifice
Please let me be under your wings...

kag_kins
Newbie
Posts: 24
Joined: Thu Dec 11, 2008 6:01 pm
Contact:

Re: Changing the links on the Main Menu

#3 Post by kag_kins »

I tried to modify my code, but I got an error.

Here's what I used:

Code: Select all

    config.main_menu = [
        (u"New Game", "start", "True"),
        (u"Load Game", _intra_jumps("load_screen", "main_game_transition"), "True"),
        (u"Preferences", _intra_jumps("preferences_screen", "main_game_transition"), "True"),
        (u"Extras", "extras", "True"),
        (u"About", "about", "True")
        (u"Quit", ui.jumps("_quit"), "True")
        ]
Here's the traceback:

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py
script.

TypeError: 'tuple' object is not callable

While executing init code:
 - script at line 10 of C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\Test/game/options.rpy
 - python at line 150 of C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\Test/game/options.rpy.

-- Full Traceback ------------------------------------------------------------

  File "C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\renpy\bootstrap.py", line 247, in bootstrap
  File "C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\renpy\main.py", line 253, in main
  File "C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\renpy\execution.py", line 199, in run
  File "C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\renpy\ast.py", line 554, in execute
  File "C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\renpy\python.py", line 880, in py_exec_bytecode
  File "C:\Users\Laura\Desktop\Renpy\renpy-6.8.0\Test/game/options.rpy", line 150, in <module>
TypeError: 'tuple' object is not callable

While executing init code:

Ren'Py Version: Ren'Py 6.8.0f
Aside from the obvious question of what I did wrong (I did create labels for 'extras' and 'about'), what's a tuple?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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 the links on the Main Menu

#4 Post by PyTom »

You left out a comma at the end of the line containing About.
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

kag_kins
Newbie
Posts: 24
Joined: Thu Dec 11, 2008 6:01 pm
Contact:

Re: Changing the links on the Main Menu

#5 Post by kag_kins »

*facepalm*

Figures it's something like that...

Okay, that just leaves the Extras. How can I put unlocking conditions on things? Not just the CG gallery (although I need help there too...) but other things, like character bios or deleted scenes?

If this is too off from my first problem, just say so and I'll make a new topic for it.

Thanks.

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Changing the links on the Main Menu

#6 Post by EvilDragon »

The last part of the tuple is the condition which must be True to show the button. Say, if you put a variable x there (just for an example), then when in script you say x=True, the button will show up.
Angels of paradise, angels of sacrifice
Please let me be under your wings...

kag_kins
Newbie
Posts: 24
Joined: Thu Dec 11, 2008 6:01 pm
Contact:

Re: Changing the links on the Main Menu

#7 Post by kag_kins »

Thanks; that clears a few things up. (I wonder why it's called that, though...?)

EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: Changing the links on the Main Menu

#8 Post by EvilDragon »

What, tuple?
Angels of paradise, angels of sacrifice
Please let me be under your wings...

kag_kins
Newbie
Posts: 24
Joined: Thu Dec 11, 2008 6:01 pm
Contact:

Re: Changing the links on the Main Menu

#9 Post by kag_kins »

Yeah. I'm sure there's a reason for it, but 'tuple'? To my uneducated eyes, it sort of looks like a pokemon name... though at least that means I'll hopefully remember it.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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 the links on the Main Menu

#10 Post by PyTom »

Two thing are a pair.
Three things are a triple.
Four things are a quadruple.
Five things are a quintuple.
Six things are a sextuple.
Seven things are a septuple.
Eight things are an octuple.

n things are an n-tuple, so we call any ordered collection of things with finite size a tuple.

(That being said, it would make a good name for a pokémon that could break into multiple parts.)
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

kag_kins
Newbie
Posts: 24
Joined: Thu Dec 11, 2008 6:01 pm
Contact:

Re: Changing the links on the Main Menu

#11 Post by kag_kins »

That makes more sense. Thanks!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]