[SOLVED]"Return button doesn't working" even though the game still runs

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
Kashahime
Newbie
Posts: 5
Joined: Tue Jul 16, 2019 11:26 pm
Contact:

[SOLVED]"Return button doesn't working" even though the game still runs

#1 Post by Kashahime »

Hi, I'm making a sub-screen as a character info screen for my Characters Profile screen. Things went smoothly and ran smoothly until the return button didn't work (although the game still runs well, nothing happend when I click on the button).
If it just normal main menu-linking screen like "about" or "preferences" (that open by ShowMenu() ), the button works perfectly, but when it comes to other screen opens by 'Show()', it doesn't work.

Code: Select all

    imagebutton idle "gui/button/mainmenu_return_button.png" xpos 1173 ypos 617 action Return() activate_sound "music/click_sound_return.mp3"

I tried to change the destination of the button by change it from Return() to ShowMenu("profile") and Show("profile"), still nothing happened.
Can someone tell me why and help me solve this case?
PS: I'm a completely newbie both in Ren'Py and Python

Since I'm not sure where the problem is, I will upload both Profile screen and its sub-screen
Profile screen:

Code: Select all

#_#_#PROFILE_SCREEN_____KAMI
screen profile():

    # Ensure this replaces the main menu.
    tag menu

    style_prefix "profile"

    add gui.profile_background
    add gui.profile_background_frame_full

#_MAIN_CLASSIFICATION
    textbutton _("Kami") xpos 1177 ypos 58 action Show("profile") activate_sound "music/click_sound_subscreen.mp3"
    textbutton _("Human") xpos 1168 ypos 130 action Show("human") activate_sound "music/click_sound_subscreen.mp3"
    textbutton _("Shiki") xpos 1177 ypos 202 action Show("shiki") activate_sound "music/click_sound_subscreen.mp3"
    textbutton _("Youkai") xpos 1171 ypos 274 action Show("youkai") activate_sound "music/click_sound_subscreen.mp3"

#_#_#PROFILE_SCREEN_____KAMI_____START____##################
    #_#_# ____ROW ___1_______
    imagebutton idle "gui/character profile/kami_iwanaga.png" xpos 30 ypos 37 action Show("kami_iwanaga")
    imagebutton idle "gui/character profile/kami_miketsu.png" xpos 190 ypos 37 #action Show("kami_miketsu")
    imagebutton idle "gui/character profile/kami_susabi.png" xpos 350 ypos 37 #action Show("kami_susabi")
    imagebutton idle "gui/character profile/kami_amaterasu.png" xpos 510 ypos 37 #action Show("kami_amaterasu")

    imagebutton idle "gui/button/mainmenu_return_button.png" xpos 1173 ypos 617 action Return() activate_sound "music/click_sound_return.mp3"
Sub-screen:

Code: Select all

#_#_IWANAGA_
screen kami_iwanaga():

    # Ensure this replaces the main menu.
    tag menu3

    style_prefix "kami_iwanaga"

    add gui.profile_background
    add gui.character_profile_iwanaga
    add gui.character_profile_contents_box_iwanaga


    imagebutton idle "gui/button/mainmenu_return_button.png" xpos 1173 ypos 617 action Return() activate_sound "music/click_sound_return.mp3"

Last edited by Kashahime on Fri Jul 19, 2019 9:47 am, edited 1 time in total.

User avatar
Enchant00
Regular
Posts: 136
Joined: Tue Jan 12, 2016 1:17 am
Contact:

Re: "Return button doesn't working" even though the game still runs

#2 Post by Enchant00 »

Hmm yeah, I don't see to see what's wrong with your code. Since you used the tag menu, it should replace the game_menu and return back to game. If you're just trying to go back to the game from the menu, try to hide the screen instead.

Code: Select all

imagebutton idle "gui/button/mainmenu_return_button.png" xpos 1173 ypos 617 action Hide("profile") activate_sound "music/click_sound_return.mp3"
If that still doesn't work, then there might be some problem with how your profile screen is shown. So, if the problem somehow persists let's try calling your screen manually.

We will first change the key_bindings. We remove the buttons associated to opening the game menu.

Code: Select all

init:
    $ config.keymap['game_menu'].remove('K_ESCAPE')
    $ config.keymap['game_menu'].remove('K_MENU')
    $ config.keymap['game_menu'].remove('mouseup_3')
We then create a screen to change the keymaps and call your profile screen.

Code: Select all

screen debug_button:
    key "K_ESCAPE" action Call('Profile')
    key "K_MENU" action Call('Profile')
    key "mouseup_3" action Call('Profile')
We then make sure that at the start of the game, the screen remap_menu is shown first before anything else
Script.rpy

Code: Select all

# This is to remove the associated buttons for game_menu
init:
    $ config.keymap['game_menu'].remove('K_ESCAPE')
    $ config.keymap['game_menu'].remove('K_MENU')
    $ config.keymap['game_menu'].remove('mouseup_3')

screen remap_menu:
    key "K_ESCAPE" action Call('Profile')
    key "K_MENU" action Call('Profile')
    key "mouseup_3" action Call('Profile')
     
# The game starts here.

label start:
    show screen remap_menu
    

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

Re: "Return button doesn't working" even though the game still runs

#3 Post by Alex »

Code: Select all

screen kami_iwanaga():

    # Ensure this replaces the main menu.
    tag menu3 #<--- menu 3 ?!
Looks like this menu doesn't replace others...

Kashahime
Newbie
Posts: 5
Joined: Tue Jul 16, 2019 11:26 pm
Contact:

Re: "Return button doesn't working" even though the game still runs

#4 Post by Kashahime »

Alex wrote: Wed Jul 17, 2019 1:23 pm

Code: Select all

screen kami_iwanaga():

    # Ensure this replaces the main menu.
    tag menu3 #<--- menu 3 ?!
Looks like this menu doesn't replace others...
Yeah.... when I changed it back to menu then its return to main menu screen normally, however what I need is to return to the profile screen, but I don't know how to set up the tag for the profile screen TT-TT. Is there any way to do it?

EDIT: Ah no, I found it out. Turned out I just need to change Return() to ShowMenu("profile"). Thank you for your time.

Post Reply

Who is online

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