menu command in python (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
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

menu command in python (solved)

#1 Post by Ayutac »

Hi there, caption says it all, I want to get this

Code: Select all

menu:
    Prota "What should I do now"
        
        "back to map":
            jump world
        
        "go climbing":
            [...]
            jump vulcano0
        
        "speak to Cynthia":
            jump meetCynthia
into python language and after many search pages my only result was this. Not bad so far, but by this I can only give the choices, but no line like in the second line of my first code example. If I write this:

Code: Select all

    python:
        Prota("What should I do now?")
        resultVal = menu([("back to map", 0)])
there is a break between the Prota's line and the choices. As said I can't find the proper solution so I'm asking you guys :)

EDIT: The solution is

Code: Select all

    python:
        Prota("What should I do now?", interact = False)
        resultVal = menu([("back to map", 0)])
Last edited by Ayutac on Thu Nov 01, 2012 4:42 am, edited 1 time in total.
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

pucedragonlord
Regular
Posts: 159
Joined: Wed May 09, 2012 2:49 am
Projects: The Diviner
Organization: Two Crowns Entertainment
Location: Now: Charlottesville, VA
Contact:

Re: menu command in python

#2 Post by pucedragonlord »

This is just a guess, but you could try having the first item in the menu be ("What should I do now?", None), which will make it a "non selectable caption," according to the wiki page on ui.menu.
The more you know

User avatar
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

Re: menu command in python

#3 Post by Ayutac »

Unfortunately, it works not.

Code: Select all

python:
    $ result = menu("What now?", [('choice 1', 'one'), ('choice 2', 'two')])
    $ result = menu(["What now?", ('choice 1', 'one'), ('choice 2', 'two')])
    $ result = menu([('choice 1', 'one'), ('choice 2', 'two'), "What now?"])
    $ result = menu([('choice 1', 'one'), ('choice 2', 'two')], "What now?")
all work not, at least they just do the same as

Code: Select all

python:
    $ result = menu([('choice 1', 'one'), ('choice 2', 'two')])
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: menu command in python

#4 Post by AxemRed »

None of those pack the "What now" option inside a 2-tuple together with None.

User avatar
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

Re: menu command in python

#5 Post by Ayutac »

I replaced "What now?" by ("What now?", None) in all for possibilities (as shown above) and it don't work.

EDIT: Got the solution by PM and edited it into first post.
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]