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.
-
wbertheau
- Newbie
- Posts: 3
- Joined: Tue Aug 09, 2022 11:20 am
-
Contact:
#1
Post
by wbertheau » Tue Aug 09, 2022 11:25 am
Hello,
As the subject said, i'm just started with renpy, i've learned alot trough youtube and google searches, but i can't seem to find out how to navigate rooms without the same dialogue "spawns" everytime.
For exempel:
You wake up, it says go to the kitchen, when you arrive at the kitchen for the first time, a dialogue pops, but when that ends i and i go out of the room and comeback, i want just the room.
Here is my code for the kitchen:
Code: Select all
label kitchen:
scene bg_kitchen
$ kitchenentered = "No"
if kitchenentered == "No":
show eileen happy at left with dissolve
e "Hello [mcname]"
hide eileen happy
show eileen happy happy at right with dissolve
m "Hello mom"
call screen bg_kitchen
screen bg_kitchen:
add "bg_kitchen"
imagebutton:
focus_mask True
idle "Kitchen/to_livingroom_idle.png"
hover "kitchen/to_livingroom_hover.png"
action Jump("upstairs")
-
Alex
- Lemma-Class Veteran
- Posts: 2981
- Joined: Fri Dec 11, 2009 5:25 pm
-
Contact:
#2
Post
by Alex » Tue Aug 09, 2022 12:50 pm
Try to put all those '$ kitchenentered = "No"' outside of locations labels. For now every time game jumps to the kitchen label the 'kitchenentered' variable sets to 'No'.
Code: Select all
# declare all the necessary variables using
# default statement
default kitchenentered = 'No'
label start:
"..."
jump kitchen
label kitchen:
scene bg_kitchen
if kitchenentered == "No":
# set new value for flag-variable
$ kitchenentered = "Yes" # <--- !!!
show eileen happy at left with dissolve
e "Hello [mcname]"
hide eileen happy
show eileen happy happy at right with dissolve
m "Hello mom"
call screen bg_kitchen
https://www.renpy.org/doc/html/python.h ... -statement
-
wbertheau
- Newbie
- Posts: 3
- Joined: Tue Aug 09, 2022 11:20 am
-
Contact:
#3
Post
by wbertheau » Tue Aug 09, 2022 12:57 pm
I will try this asap, thank you.
-
m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
-
Contact:
#4
Post
by m_from_space » Wed Aug 10, 2022 2:29 am
For simple "yes"/"no" flags you should learn about using
booleans instead. Just use the values of
True and
False (case-sensitive!), it's much easier to test for them, too.
Code: Select all
default kitchenentered = False
label start:
"..."
jump kitchen
label kitchen:
scene bg_kitchen
if not kitchenentered:
$ kitchenentered = True
#...
-
wbertheau
- Newbie
- Posts: 3
- Joined: Tue Aug 09, 2022 11:20 am
-
Contact:
#5
Post
by wbertheau » Wed Aug 10, 2022 10:48 am
Thank you so much, Alex.
And also you m_from_space.
Alex wrote: ↑Tue Aug 09, 2022 12:50 pm
Try to put all those '$ kitchenentered = "No"' outside of locations labels. For now every time game jumps to the kitchen label the 'kitchenentered' variable sets to 'No'.
Code: Select all
# declare all the necessary variables using
# default statement
default kitchenentered = 'No'
label start:
"..."
jump kitchen
label kitchen:
scene bg_kitchen
if kitchenentered == "No":
# set new value for flag-variable
$ kitchenentered = "Yes" # <--- !!!
show eileen happy at left with dissolve
e "Hello [mcname]"
hide eileen happy
show eileen happy happy at right with dissolve
m "Hello mom"
call screen bg_kitchen
https://www.renpy.org/doc/html/python.h ... -statement
Users browsing this forum: Bing [Bot]