[Solved] Problem with calls and dialog skipping

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
Mimrose
Regular
Posts: 33
Joined: Thu May 02, 2013 1:46 pm
Projects: Bitter Honey (Writer)
Contact:

[Solved] Problem with calls and dialog skipping

#1 Post by Mimrose » Wed May 22, 2013 4:37 pm

Hi!

In my code, I've created a separate document to keep track of the scenes resulting from different choices in my VN, so I won't have too many lines stuffed into the main script.

However, I'm a little confused about why my game is skipping past certain points in my dialogue.

The code below is the "scenes" script that has the dialogue you would see in making certain choices in the VN.

Code: Select all

# Day one scenes
# Choosing what to do with Raphael's gift

label wearearrings:
    
        "Carefully, I slide the earrings into my ear lobes. They don't feel too heavy, and hang delicately on my ears."
        
        m "They feel great, Raphael! Thank you!"
        
        r "They look so nice on you, %(player_name)s!"
        
        "Raphael seems to be really happy that I like his earrings so much! They truly are special."
        
label safekeeping:
            
        "I gently wrap them back up, and carefully place them in my drawer."
        
        m "Thank you for the beautiful gift Raphael! I'll make sure to keep them safe."
        
        "Raphael's smile falters for a second, but it disappears quickly."
        
        r "Oh, okay. I'm glad you like them."

# Choosing who to sit with

label sitbyzane:
             
        "Flashing Raphael an apologetic smile, I make my way towards the empty chair by Zane." 
        
        "He smiles at me when I sit down, and gives my hand a gentle squeeze."
        
        z "Happy Birthday %(player_name)s. I have a gift for you, but you'll have to wait until later to see it."
        
        "I pretend to act annoyed, groaning and placing a hand to my forehead."
        
        m "It's not nice to make a lady wait, especially on her birthday!"
        
        z "Haven't you heard? Good things come to those who wait."
        
        "I punch his shoulder lightly."
        
        m "It's good to see you, Zane! How's it going?"
        
        z "Mrs. Beverly has been keeping me busy with all the work around this place."
        
        z "I feel like I'll never get all of it done."
        
        z "I swear she's trying to make me do all the work around here alone..."
        
        "I laugh at the disgruntled look on Zane's face."
        
        "While Mrs. Beverly does keep him pretty busy most of the time, I know she appreciates everything he does."
        
        "I'm sure he knows this as well, which is why he continues to help out when he can."
        
        m "Come on, a strong man like you shouldn't be tired so easily!"
        
        "I wink at him as I speak, making him roll his eyes at me with a laugh."
        
        z "You flatter me, my dear %(player_name)s."
        
        "Flexing his arms, Zane pretends to show off his muscles as I shake my head at his foolishness."
        
        "We make idle chatter for the rest of the meal, with good-natured jabs at each other here and there."

label sitbyraphael:
    
        "Gesturing with a slight nod towards Raphael, I smile apologetically at Zane and move towards the empty seat Raphael is waving me towards."
        
        "Raphael winks at me as I sit down."
        
        r "The best seat for the special lady!"
        
        "I hide my face in embarrassment as the children around us turn to look at me at Raphael's comment."
        
        m "Stop it, Raphael! You're embarrassing me!"
        
        r "Well, darn! You figured out my master plan!"
        
        "He chuckles at my slightly blushing face, while he digs into his breakfast."
        
        "I try to hide my red face with my hair as I pick up my own fork."
        
        "A few minutes later, Raphael places his hand gently on mine."
        
        r "I'm sorry, %(player_name)s. I hope I didn't upset you."
        
        "Raphael's normally smiling face is frowning slightly. I feel slightly better at his concern."
        
        m "It's okay, Raphael. But, you should be nice to the birthday girl on her special day, right?"
        
        "I smile at him as his mouth widens into a grin."
        
        r "Of course! We'll do anything you want today!"
        
        "The rest of the meal is filled with laughter and chatter as Raphael talks and jokes with the others around us."
        
        "I try to stop myself from laughing at his jokes long enough to finish my breakfast."
        
return
So, because I have all the scenes labeled, I would then call them in my main script as seen below:

Code: Select all

# Characters
define r = Character('Raphael', color="#F88017")
define b = Character("Mrs. Beverly", color="#FAAFBE")
define z = Character("Zane", color="#4EE2EC")

# Flags
$ metzane = False

# Points
$ raphaelpoints = 0
$ zanepoints = 0

label start:

$ player_name = renpy.input("Enter name: ").strip()
$ m = Character(player_name, color="#3BB9FF")

"My name is %(player_name)s."

"This is where I live, the Sacred Heart orphanage."
    
"There is little I can remember about my past, including my parents."
    
"Their screams are the only sounds that reverberate through my mind when I try to recall their faces."
    
"My mother had hid me underneath my bed one terrible night, and I remember peeking out and seeing blood splattered across the floor."
    
"It was raining that night, a deadly thunderstorm that accompanied the sounds of my parent's cries throughout the night."

"When day finally came and broke through the darkness, I stumbled out of my hiding place."

"The smell of blood and death nearly suffocated me, and I remember seeing the stiff, unmoving bodies of my mother and father."
        
"My throat had burned as I shrieked and cried, and eventually I passed out from sheer exhaustion."
        
"When I finally woke, I was looking up into the face of a kindly old woman, who smiled at me and told me to rest."
        
"Someone had found me and brought me to the orphanage."
        
"Life at the orphanage isn't terrible. I've made friends with the others, and we are all fairly close."
         
"We know what it feels like to be alone."
         
"For the most part, I think I'm doing fine."

"But I often have the same reoccuring nightmare, about how my parents were killed."
         
"Or even, why they were killed."
         
"There's so much I still don't know about myself."
         
"This is where my story begins."

"I'm startled awake by the feeling of something landing on my body."

m "Ow! What the heck?!"

"A boy's smiling face comes into view, along with a mischievous smirk."

r "Rise and shine, %(player_name)s! It's time to get up!"

"Raphael is a friend of mine, and he's an orphan too. His father had died a long time ago in a war, and his mother died shortly after giving birth to him."

"He's been here at the orphanage all his life."

"Playful and energetic, he's a little troublemaker that loves to play pranks and gets in trouble all the time."

"He's always so happy and cheerful-I wonder where he gets all that energy from."

r "Today's a special day!"

"Oh right. How could I have forgotten?"

"Raphael thrusts a badly wrapped package towards my face."

"The lumpy looking object is covered with wrinkled newspaper, with tape wrapped haphazardly around the entire thing."

r "Happy Birthday %(player_name)s! You're 17 now!"

"With a voice as chirpy and happy as his, I can't be mad at him for long."

m "Thanks, Raphael. I can't believe it myself. Only one more year and I'll have to leave..."

"Raphael's face immediately falls, and a frown replaces his smile."

r "Let's not think about that for now! Today is your special day! Hurry up and open your present!"

"Rolling my eyes at his eagerness, I gingerly start to tear at the package he's given me."

"Wrapped in layers of cloth are two very beautiful earrings."

"The morning light dances across the design of the earrings, causing them to shine and sparkle."

m "These are beautiful, Raphael! Where did you get them?"

"Raphael turns his head slightly, a blush blooming over his cheeks."

r "I made them. I'm glad you like them."

menu:
    
    "Wear them immediately":
        
        call wearearrings
        $ raphaelpoints += 1
        
    "Put them away for safekeeping":
        
        call safekeeping
        
"The smell of breakfast floats through the doorway, and my mouth waters at the smell of eggs and bacon."

"I blush lightly as my stomach grumbles, while Raphael laughs."

r "Well, it would be bad to let the birthday girl starve! Let's go get some breakfast in you, %(player_name)s!"

"Taking my hand, Raphael pulls me into the hallway where we make our way downstairs."

"Lively chatter fills my ears as we step into the dining room."

"All along the long table, children are seated, with plates and silverware set before them."

"Mrs. Beverly is making her way out of the kitchen, balancing several plates laden down with eggs in her arms."

"Rushing forward, I take a few plates from her, helping her with the burden."

"She smiles warmly at me."

b "Thank you, %(player_name)s! It would be bad if all the eggs ended up on the floor instead of in our stomachs!"

"Mrs. Beverly is one of the kind ladies that works at the orphanage."

"She is very smart and compassionate, and I've always seen her as a mother figure to me."

"Whenever I have problems, she gives me invaluable advice. I'm really lucky to be staying at an orphanage where someone like her is."

m "Always happy to help!"

"Raphael has already sat down in an empty seat, and he gestures for me to sit down at the seat besides him."

"As I make my way towards him, someone calls out my name."

z "%(player_name)s!"

"I turn my head instinctively at the sound."

"My friend Zane is sitting a few chairs away, waving at me."

"Zane isn't an orphan, but he can often be found here with the rest of us."

"He does some work around the building for Mrs. Beverly when he has time."

"We first met when I accidently ran into him in the middle of market one day."

"When he found out that I was an orphan, he began to visit me at the orphanage."

"He's always easy to talk to, and is protective over me."

"I feel safe around him."

z "I saved you a seat over here."

"Nervously, I glance between Zane and Raphael."

"It would be rude to refuse his offer, but maybe I should sit by Raphael instead..."

menu:
    
    "Sit by Zane":

        call sitbyzane
        $ zanepoints += 1
        $ metzane = True

    "Sit by Raphael":
        
        call sitbyraphael
        $ raphaelpoints += 1
    
"When everyone is done with breakfast, Mrs. Beverly ushers everyone out of the dining room."

"I don't have much to do, but I guess I could go and talk with Zane or Raphael. I could also just go and relax in my room."

return
The problem in my code is after making the first choice (Wear the earrings or Put them away for safekeeping), and after the dialogue that follows whichever choice you make, my game skips to the dialogue that would happen if you chose to sit by Zane. It completely skips over the part about Miki and Raphael going down to breakfast, and I'm honestly having a tough time figuring out why it's doing so.

Finally, an error keeps telling me that I don't have raphaelpoints and zanepoints initialized. Am I doing something wrong in the code?

Sorry for all the questions, if you could help me out on any of it I would greatly appreciate it! :D
Last edited by Mimrose on Wed May 22, 2013 9:30 pm, edited 1 time in total.
Image

Need a writer or editor? Check out my recruitment page here! (Currently accepting short edit jobs, but closed as a writer)

Visit my tumblr for reviews about otome games, smexy pixel men, random reblogs, and fanfics! :D [/color]

User avatar
Chaotic
Regular
Posts: 30
Joined: Fri Feb 22, 2013 7:32 pm
Location: England, UK
Contact:

Re: Problem with calls and dialog skipping

#2 Post by Chaotic » Wed May 22, 2013 4:45 pm

For the scenes, I believe you've missed out a couple of 'return's after the scene has finished.

Code: Select all

# Day one scenes
# Choosing what to do with Raphael's gift

label wearearrings:
   
        "Carefully, I slide the earrings into my ear lobes. They don't feel too heavy, and hang delicately on my ears."
       
        m "They feel great, Raphael! Thank you!"
       
        r "They look so nice on you, %(player_name)s!"
       
        "Raphael seems to be really happy that I like his earrings so much! They truly are special."
        
        return
       
label safekeeping:
           
        "I gently wrap them back up, and carefully place them in my drawer."
       
        m "Thank you for the beautiful gift Raphael! I'll make sure to keep them safe."
       
        "Raphael's smile falters for a second, but it disappears quickly."
       
        r "Oh, okay. I'm glad you like them."
        
        return

# Choosing who to sit with

label sitbyzane:
             
        "Flashing Raphael an apologetic smile, I make my way towards the empty chair by Zane."
       
        "He smiles at me when I sit down, and gives my hand a gentle squeeze."
       
        z "Happy Birthday %(player_name)s. I have a gift for you, but you'll have to wait until later to see it."
       
        "I pretend to act annoyed, groaning and placing a hand to my forehead."
       
        m "It's not nice to make a lady wait, especially on her birthday!"
       
        z "Haven't you heard? Good things come to those who wait."
       
        "I punch his shoulder lightly."
       
        m "It's good to see you, Zane! How's it going?"
       
        z "Mrs. Beverly has been keeping me busy with all the work around this place."
       
        z "I feel like I'll never get all of it done."
       
        z "I swear she's trying to make me do all the work around here alone..."
       
        "I laugh at the disgruntled look on Zane's face."
       
        "While Mrs. Beverly does keep him pretty busy most of the time, I know she appreciates everything he does."
       
        "I'm sure he knows this as well, which is why he continues to help out when he can."
       
        m "Come on, a strong man like you shouldn't be tired so easily!"
       
        "I wink at him as I speak, making him roll his eyes at me with a laugh."
       
        z "You flatter me, my dear %(player_name)s."
       
        "Flexing his arms, Zane pretends to show off his muscles as I shake my head at his foolishness."
       
        "We make idle chatter for the rest of the meal, with good-natured jabs at each other here and there."
        
        return

label sitbyraphael:
   
        "Gesturing with a slight nod towards Raphael, I smile apologetically at Zane and move towards the empty seat Raphael is waving me towards."
       
        "Raphael winks at me as I sit down."
       
        r "The best seat for the special lady!"
       
        "I hide my face in embarrassment as the children around us turn to look at me at Raphael's comment."
       
        m "Stop it, Raphael! You're embarrassing me!"
       
        r "Well, darn! You figured out my master plan!"
       
        "He chuckles at my slightly blushing face, while he digs into his breakfast."
       
        "I try to hide my red face with my hair as I pick up my own fork."
       
        "A few minutes later, Raphael places his hand gently on mine."
       
        r "I'm sorry, %(player_name)s. I hope I didn't upset you."
       
        "Raphael's normally smiling face is frowning slightly. I feel slightly better at his concern."
       
        m "It's okay, Raphael. But, you should be nice to the birthday girl on her special day, right?"
       
        "I smile at him as his mouth widens into a grin."
       
        r "Of course! We'll do anything you want today!"
       
        "The rest of the meal is filled with laughter and chatter as Raphael talks and jokes with the others around us."
       
        "I try to stop myself from laughing at his jokes long enough to finish my breakfast."
        
        return
For the points and flags, you must put them in an 'init' block like so...

Code: Select all

# Characters
define r = Character('Raphael', color="#F88017")
define b = Character("Mrs. Beverly", color="#FAAFBE")
define z = Character("Zane", color="#4EE2EC")

init:
    # Flags
    $ metzane = False
    
    # Points
    $ raphaelpoints = 0
    $ zanepoints = 0
Here's some help with points and making a game in Ren'Py...
http://www.otome-games.com/index.php/ma ... tome-games
http://lemmasoft.renai.us/forums/viewto ... 51&t=17363
http://lemmasoft.renai.us/forums/viewto ... lit=points
http://lemmasoft.renai.us/forums/viewto ... lit=points
I've put these for you before haven't I? xD Sorry again ._.

Also, by using %(player_name)s, does the inputted name show up for you?

User avatar
Mimrose
Regular
Posts: 33
Joined: Thu May 02, 2013 1:46 pm
Projects: Bitter Honey (Writer)
Contact:

Re: Problem with calls and dialog skipping

#3 Post by Mimrose » Wed May 22, 2013 5:09 pm

Thanks so much for your help! Adding the returns and the init block solved the errors :D :D

What exactly does the return command do anyways? I never really understood that.

Your links were very helpful so it's totally okay! They helped me make the scenes and the point system.

Yes, by using %(player_name)s, the inputted name does show up for me-I just went through the game and confirmed it.

Thanks again for all your help, I really appreciate it! :)
Image

Need a writer or editor? Check out my recruitment page here! (Currently accepting short edit jobs, but closed as a writer)

Visit my tumblr for reviews about otome games, smexy pixel men, random reblogs, and fanfics! :D [/color]

User avatar
Chaotic
Regular
Posts: 30
Joined: Fri Feb 22, 2013 7:32 pm
Location: England, UK
Contact:

Re: Problem with calls and dialog skipping

#4 Post by Chaotic » Wed May 22, 2013 7:25 pm

You're welcome!
From my knowledge, return just takes you back to where you were before...but I'm still in learning myself so please just look around the renpy wiki for further clarifications :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Capella, Google [Bot]