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.
-
Vennnot
- Newbie
- Posts: 12
- Joined: Mon Mar 19, 2018 4:48 pm
-
Contact:
#1
Post
by Vennnot » Mon Mar 08, 2021 4:45 pm
Hey everyone, I'm quite new to renpy and I've been watching a couple of tutorials. I have this issue where my visual novel jumps to my last label and I don't know why. It should go to intro first and then go through the motions. As of right now it instantly skips to hallway 1 and I can't figure out why. Any help is appreciated:
Code: Select all
define main = Character("[name]", color="#ffffff") # The player, man #1
define emm = Character("Emma", color="#cc75ff") # Emma, girl #3
# Define images and resolutions
image hallway2 = "hallway2.png"
image hallway1 = "hallway1.png"
image test_happy = "hoshi_school_smile.png"
image test_embarrassed1 = "hoshi_school_embarrassed1.png"
image test_embarrassed2 = "hoshi_school_embarrassed2.png"
image test_upset = "hoshi_school_upset.png"
# The game starts here. Ask for players name, if no name is given, return Robbie
label start:
call Variables
if introDone == True:
jump hallway2
label intro:
python:
name = renpy.input("What's your name?")
name = name.strip() or "Robbie"
#$ playerName == name
scene intro
"{cps=25}It's been a month since I dropped out of trade school and lost my scholarship.{/cps}"
"{cps=25}I've been looking for an apartment and a job, and I finally found something.{/cps}"
"{cps=25}I found a run down apartment in the boonies and a shitty job. It's a kick to the balls but I've come back to work here.{/cps}"
"{cps=25} {b}Fucking embarrassing{/b}{/cps}{cps=2}... {/cps}{cps=15}but I need the job.{/cps}"
$ introDone = False
label hallway2:
scene hallway2
hide screen gotohallway2
if firstStart == True:
show test_happy at right with dissolve
emm "Hey anon! I'm so glad you came to school today! I was worried you were going to leave me alone again..."
hide test_happy
show test_embarrassed1 at right
emm "Can I have lunch with you today?"
$ firstStart = False
menu:
"Uhm, sorry I promised Belle Delphine I would have lunch with her... So...":
call noToLunch
"Sure.":
call yesToLunch
hide test_upset with dissolve
hide test_embarrassed2 with dissolve
show screen gotohallway1
$ renpy.pause(hard=True)
label yesToLunch:
hide test_embarrassed1
show test_happy at right
emm "Yay!"
hide test_happy
show test_embarrassed2 at right
emm "I mean, uhm, see you then anon..."
return
label noToLunch:
hide test_embarrassed1
show test_upset at right
emm "Whatever Anon! You're such a jerk!"
main "... What's that all about?"
return
label Variables:
$ firstStart = True
$ introDone = False
$ playerName = "Robbie"
label hallway1:
scene hallway1
hide screen gotohallway1
show screen gotohallway2
"if you are seeing this you fucked up or finished the game"
$ renpy.pause(hard=True)
-
_ticlock_
- Veteran
- Posts: 391
- Joined: Mon Oct 26, 2020 5:41 pm
-
Contact:
#2
Post
by _ticlock_ » Mon Mar 08, 2021 5:01 pm
Hi,
Vennnot,
You did not put return statement in the label Variables:
Defining the variables in such a way is not a good idea. It is recommended to use the
default statement to define variables and
define statements to define constants. This way you won't have possible problems with save files and incompatibility of save files between different versions of the game. So you don't need the label Variables at all. Instead:
Code: Select all
default firstStart = True
default introDone = False
default playerName = "Robbie"
label start:
if introDone == True:
jump hallway2
Last edited by
_ticlock_ on Mon Mar 08, 2021 5:02 pm, edited 1 time in total.
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#3
Post
by Imperf3kt » Mon Mar 08, 2021 5:01 pm
You need to add a return at the end of your 'variables' label.
Right now, you call it at the start of the game, but it never returns and carries on into the next label, which happens to be hallway1
I wouldn't recommend doing your variables that way though, as it can cause issues with loading and future updates to the game.
Use default before the start label, instead.
Edit:
Looks like _ticlock_ beat me by a few seconds lol
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
Vennnot
- Newbie
- Posts: 12
- Joined: Mon Mar 19, 2018 4:48 pm
-
Contact:
#4
Post
by Vennnot » Mon Mar 08, 2021 5:05 pm
Thanks guys! I appreciate it the help!
-
m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
-
Contact:
#5
Post
by m_from_space » Tue Mar 16, 2021 2:40 am
An hint regarding using images in Renpy:
You don't have to define images, but just put them into your ".../game/images" folder, e.g. "hoshi school smile.png" and "hoshi school upset.png". Renpy will automatically detect those images and assign variables (don't put _ between the words). In this case you then can do:
Code: Select all
show hoshi school smile at center
"Hey you!"
show hoshi school upset
"Now I am upset."
It is nearly never necessary to use "hide" on an image, since it automatically get's replaced with images that have the same "tag".
Users browsing this forum: Bing [Bot], khezo