Page 1 of 1

Changing the links on the Main Menu

Posted: Sat Jun 06, 2009 2:04 am
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?

Re: Changing the links on the Main Menu

Posted: Sat Jun 06, 2009 4:50 am
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.

Re: Changing the links on the Main Menu

Posted: Sat Jun 06, 2009 4:47 pm
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?

Re: Changing the links on the Main Menu

Posted: Sat Jun 06, 2009 4:58 pm
by PyTom
You left out a comma at the end of the line containing About.

Re: Changing the links on the Main Menu

Posted: Sat Jun 06, 2009 7:10 pm
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.

Re: Changing the links on the Main Menu

Posted: Sat Jun 06, 2009 8:20 pm
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.

Re: Changing the links on the Main Menu

Posted: Sat Jun 06, 2009 8:38 pm
by kag_kins
Thanks; that clears a few things up. (I wonder why it's called that, though...?)

Re: Changing the links on the Main Menu

Posted: Mon Jun 08, 2009 5:06 am
by EvilDragon
What, tuple?

Re: Changing the links on the Main Menu

Posted: Mon Jun 08, 2009 2:51 pm
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.

Re: Changing the links on the Main Menu

Posted: Mon Jun 08, 2009 3:03 pm
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.)

Re: Changing the links on the Main Menu

Posted: Mon Jun 08, 2009 7:05 pm
by kag_kins
That makes more sense. Thanks!