[Solved] Return() not working as intended

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
risukadekei
Newbie
Posts: 2
Joined: Wed Jul 14, 2021 1:14 pm
Contact:

[Solved] Return() not working as intended

#1 Post by risukadekei »

At least, I think it is Return() that isn't working correctly.

Have copy+pasted some working code into an almost fresh project. In the original, a character creation screen is called, and when "continue" is clicked (hotspot with action Return()) the game continues. With the copy paste, when continue is clicked it returns to the main menu. The script.rpy files and the files containing the character creation screen are identical in both projects, the only difference in the copy paste project is it has an imagemap main menu.

So far I have tried replacing Return() with a jump to a label further down in the script.rpy file from where the screen is called, though that keeps giving errors. Tried setting a variable before the character creation screen is called that if false will lead to the screen being called, the screen being called sets it to true which I hoped would mean maybe Return() would make it loop back round and not call the character creation screen that time? Didn't work. Tried putting various things in the brackets after return, no luck with that either. (Can't remember what else I've tried, it's been a long day.) Everything I have tried has either come up with errors or has the same issue of returning to the main menu.

I'm not sure exactly which bits of code are the issue here so sorry if I've not found the right bit

the script.rpy file

Code: Select all

#image keri = DynamicDisplayable(keri_sprite) #uncomment to use python version
image school = "Modern_School.png"
label start:
    call screen dress_keri
    scene school
    $ quick_menu = True
    show keri:
        pos(800, 120)
        zoom 0.5
    "You've created your look!"
    return
condensed version of character creation screen

Code: Select all

init:
    default skin_color = 1
    default hairstyle = 1
    default hair_color = 1
    default eyes = 1
    default eye_color = 1
    default top_choice = 1
    default bottom_choice = 1
    default top_style = 1
    default top_style_max = 6
    default bottom_style = 1
    default bottom_style_max = 6
#####################################renpy langauge version:
image keri = Composite(
    (467, 946),
    (0, 0), "Create_Character/Base/base[skin_color].png",
    etc
)
#####################################python version:
init python:
    def keri_sprite(st, at):
        return LiveComposite(
            (467, 946),
            etc
        ),.1

screen dress_keri():
    modal True

    imagemap:
        ground "Dressup_Screen/background.png"
        etc

        ##Skin Color##
        hotspot(267, 112, 80, 80) action SetVariable("skin_color", 1)
        etc

        ##Hairstyle##
        hotspot(267, 233, 80, 80) action SetVariable("hairstyle", 1)
        etc

        ##Hair Color##
        hotspot(267, 352, 80, 80) action SetVariable("hair_color", 1)
        etc

        ##Eyes##
        hotspot(267, 675, 80, 80) action SetVariable("eyes", 1)
        etc

        ##Eye Color##
        hotspot(267, 794, 80, 80) action SetVariable("eye_color", 1)
        etc

        ##Top Choice##
        hotspot(952, 112, 80, 80) action SetVariable("top_choice", 1)
        etc

        ##Bottom Choice##
        hotspot(952, 233, 80, 80) action SetVariable("bottom_choice", 1)
        etc

        ##Top Style##
        hotspot(1231, 522, 88, 77) action If(top_style > 1, SetVariable("top_style", top_style - 1), SetVariable("top_style", 1))
        hotspot(1800, 522, 88, 77) action If(top_style < top_style_max, SetVariable("top_style", top_style + 1), SetVariable("top_style", top_style_max))

        ##Bottom Style##
        hotspot(1231, 853, 88, 77) action If(bottom_style > 1, SetVariable("bottom_style", bottom_style - 1), SetVariable("bottom_style", 1))
        hotspot(1800, 853, 88, 77) action If(bottom_style < bottom_style_max, SetVariable("bottom_style", bottom_style + 1), SetVariable("bottom_style", bottom_style_max))

        ##Continue##
        hotspot(1661, 14, 236, 80) action Return()

    add "keri":
        pos(1300, 120)
        zoom 0.5
The imagemap main menu

Code: Select all

screen navigation():

    imagemap:

        idle "gui/mm_idle.png"
        hover "gui/mm_hover.png"
        ground "gui/mm_ground.png"

        hotspot (0, 53, 733, 202) action ShowMenu('start')
        hotspot (0, 305, 685, 204) action ShowMenu('load')
        hotspot (0, 567, 635, 203) action ShowMenu('preferences')
        hotspot (0, 810, 584, 198) action ShowMenu('help')
        hotspot (1432, 565, 486, 203) action ShowMenu('about')
        hotspot (1359, 808, 560, 199) action Quit('quit')
Last edited by risukadekei on Wed Jul 14, 2021 3:40 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Return() not working as intended

#2 Post by Alex »

risukadekei wrote: Wed Jul 14, 2021 1:38 pm ...

Code: Select all

        hotspot (0, 53, 733, 202) action ShowMenu('start')
Why it is showing menu instead of doing Start()-action?
https://www.renpy.org/doc/html/screen_a ... html#Start

risukadekei
Newbie
Posts: 2
Joined: Wed Jul 14, 2021 1:14 pm
Contact:

Re: Return() not working as intended

#3 Post by risukadekei »

Alex wrote: Wed Jul 14, 2021 2:10 pm
risukadekei wrote: Wed Jul 14, 2021 1:38 pm ...

Code: Select all

        hotspot (0, 53, 733, 202) action ShowMenu('start')
Why it is showing menu instead of doing Start()-action?
https://www.renpy.org/doc/html/screen_a ... html#Start
Ah, the tutorial I was following used showmenu. This has fixed it though, thank you!

Post Reply

Who is online

Users browsing this forum: Google [Bot]