Having trouble getting a yes/no prompt to appear

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
pandajenni
Newbie
Posts: 3
Joined: Wed Jan 27, 2016 11:50 am
Contact:

Having trouble getting a yes/no prompt to appear

#1 Post by pandajenni »

I've been working on developing a project for a research study, the final project is mostly done, I'm just trying to add tweaks to it. My problems begin with trying to use a Y/N prompt, getting one to appear that is. The line of code I use looks like this: $layout.yesno_screen ("Choose this music?", yes=renpy.jump("choice_hap"), no=renpy.jump("returnPoint"))


I'm failing in getting the yes no screen to appear, along with the y/n screen I'm trying to develop a return point which coding looks like this:

Code: Select all

label MusicSelect:
    $ musicList = ["SoramimiCake.mp3", "Epic.mp3", "Troika.mp3" ]
    $ index = -1 
label returnPoint:
python: 
    index +=1
    if index > len(musicList):
        index = 0
"Please choose the music you would like to hear."
menu: 
    
    "GOAL: How would you keep your focus while driving?"
    with dissolve
    "[musicList[index]]"
    "[hap1]":
        $layout.yesno_screen ("Choose this music?", yes=renpy.jump("choice_hap"), no=renpy.jump("returnPoint"))
When I input that code I keep getting an error message that states: list indices must be integers not unicode

Is there anyone who knows where I went wrong in the code?
Last edited by pandajenni on Mon Feb 15, 2016 10:19 am, edited 2 times in total.

User avatar
Iylae
Regular
Posts: 73
Joined: Sat Jan 09, 2016 6:57 am
Location: Cornwall, UK
Contact:

Re: Having trouble getting a yes/no prompt to appear

#2 Post by Iylae »

Wrap your code in

Code: Select all

 tags so we can see the indentations please.
Image
  If we are what we repeatedly do, then good coding is not an act, but a habit

User avatar
Taleweaver
Writing Maniac
Posts: 3428
Joined: Tue Nov 11, 2003 8:51 am
Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
Organization: Tall Tales Productions
Location: Germany
Contact:

Re: Having trouble getting a yes/no prompt to appear

#3 Post by Taleweaver »

Moved to Ren'Py Questions.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of Daemonophilia
Scriptwriter and director of The Dreaming
Scriptwriter of Zenith Chronicles
Scriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is Dead
Scriptwriter and producer of Adrift
More about me in my blog
"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: Having trouble getting a yes/no prompt to appear

#4 Post by mobychan »

As Iyale stated, please wrap your code in a code block

I believe your problem is your

Code: Select all

"musicList[index]"
try saving that value in it's own variable first and then use it in the text:

Code: Select all

$ musicAtIndex = musicList[index]

Code: Select all

"[musicAtIndex]"

Post Reply

Who is online

Users browsing this forum: Google [Bot]