Problem with Label Call

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
ivilica
Newbie
Posts: 4
Joined: Wed Jan 03, 2024 11:09 am
Contact:

Problem with Label Call

#1 Post by ivilica »

I'm encountering a problem with my game where the "Freeroam3" route doesn't work as expected. The game starts with a white screen and a menu with two options: "Freeroam2" and "Freeroam3".

The "Freeroam2" route works perfectly. When I select "Freeroam2", it displays the FR_2_3 screen, and clicking the button on that screen successfully jumps to the label FRC2 as intended.

However, the "Freeroam3" route breaks in a strange way. When I select "Freeroam3", it displays the FR_3_12 screen as it should. But when I click the button on the FR_3_12 screen, instead of jumping directly to the label FRC3_1, the game seems to reset and shows a white screen again. Then, I have to click somewhere on the screen again (not the menu, as it doesn't show up) to finally jump to the FRC3_1 label.

Here's the code I'm using:

show whitescreen

menu:

"Freeroam2":

jump freeroam2

"Freeroam3":

jump freeroam3

label freeroam2:

screen FR_2_3:

zorder -10

add "freeroam/FR-2-3.png"

if quest.is_state("quest2-1", "unlocked"):

imagebutton:

xpos 1271

ypos 423

auto ("freeroam/FR-2-7_%s.png")

action [Call("FRC2")]

$ quest.load(chapter2)

$ quest.check("quest2-1", "unlocked")

$ renpy.block_rollback()

$ _skipping = False

show screen FR_2_3

$ renpy.pause(hard=True)

label FRC2:

show fr-2-3

hide screen FR_2_3

show scene-422 with dissolve

$ config.rollback_enabled = False

$ _skipping = True

blank "....."

$ config.rollback_enabled = True

dialogue
$ _skipping = False

$ quest.check("quest2-1", "done")

hide scene-422

$ renpy.block_rollback()

show screen FR_2_3

$ renpy.pause(hard=True)

return

label freeroam3:

screen FR_3_12:

zorder -10

add "freeroam/FR-3-12.png"

if quest.is_state("quest3-1", "unlocked"):

imagebutton:

xpos 17

ypos 348

auto ("freeroam/FR-3-27_%s.png")

action [Call("FRC3_1")]

$ quest.load(chapter3)

$ quest.check("quest3-1", "unlocked")

$ renpy.block_rollback()

$ _skipping = False

show screen FR_3_12

$ freeroam = 1

$ renpy.pause(hard=False)

label FRC3_1:

show fr-3-12

hide screen FR_3_12

show scene-808 with dissolve

$ config.rollback_enabled = False

$ _skipping = True

blank "....."

$ config.rollback_enabled = True

dialogue
$ _skipping = False

blank "{b}Cheers!{/b}"

$ quest.check("quest3-1", "done")

hide solid_black

$ renpy.block_rollback()

show screen FR_3_12

$ renpy.pause(hard=True)

return

ivilica
Newbie
Posts: 4
Joined: Wed Jan 03, 2024 11:09 am
Contact:

Re: Problem with Label Call

#2 Post by ivilica »

Update:

I changed the order of the buttons in the screen, and now it works correctly. It jumps to the FRC3_1 label without resetting to the white screen. Can anyone explain why changing the order of the buttons fixed the issue?
I changed:
screen FR_3_12:
zorder -10
add "freeroam/FR-3-12.png"
if quest.is_state("quest3-1", "unlocked"):
imagebutton:
xpos 17
ypos 348
auto ("freeroam/FR-3-27_%s.png")
action [Call("FRC3_1")]
imagebutton:
xpos 17
ypos 348
auto ("freeroam/FR-3-27_%s.png")
action [Show("FR_3_12", transition=Dissolve(0.5)), Hide("FR_3_12")]
imagebutton:
xpos 1590
ypos 328
idle ("freeroam/Arrow_t.png")
hover ("freeroam/Arrow_right.png")
action [Show("FR_3_11", transition=Dissolve(0.5)), Hide("FR_3_12")]

To:
screen FR_3_12:
zorder -10
add "freeroam/FR-3-12.png"
imagebutton:
xpos 17
ypos 348
auto ("freeroam/FR-3-27_%s.png")
action [Show("FR_3_12", transition=Dissolve(0.5)), Hide("FR_3_12")]
imagebutton:
xpos 1590
ypos 328
idle ("freeroam/Arrow_t.png")
hover ("freeroam/Arrow_right.png")
action [Show("FR_3_11", transition=Dissolve(0.5)), Hide("FR_3_12")]
if quest.is_state("quest3-1", "unlocked"):
imagebutton:
xpos 17
ypos 348
auto ("freeroam/FR-3-27_%s.png")
action [Call("FRC3_1")]

giorgi1111
Regular
Posts: 83
Joined: Sat May 04, 2024 10:40 pm
Contact:

Re: Problem with Label Call

#3 Post by giorgi1111 »

You have to button on same position when if condition is true xpos 17 ypos 348 i think renpy shows both but one is on another and action is what has buton which is up.i dont know why you have both.but you can change if unlocked this button else that button

Post Reply

Who is online

Users browsing this forum: No registered users