How do you make it so that an in game menu is to upon closing, continue where it left off.
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.
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.
How do you make it so that an in game menu is to upon closing, continue where it left off.
I'm trying to find out how to make it so that my in-game menu, upon being closed, continues off where it left off. This in-game menu can be activated at all times throughout the VN.
Extra Info:
This in-game menu is not the same as the renpy menu, it's its own screen with different options and so forth, and the menu is triggered with the "M" key
So in an event scenario it would go like.
"Character A talks to Character B"
"Player opens In-Game Menu"
"Player closes In-Game Menu"
"Game continues off right where it left off." -> This is the bit that I hope that you guys can help me out with in figuring out how to make it continue right off where it was at before it's opened.
Extra Info:
This in-game menu is not the same as the renpy menu, it's its own screen with different options and so forth, and the menu is triggered with the "M" key
So in an event scenario it would go like.
"Character A talks to Character B"
"Player opens In-Game Menu"
"Player closes In-Game Menu"
"Game continues off right where it left off." -> This is the bit that I hope that you guys can help me out with in figuring out how to make it continue right off where it was at before it's opened.
Re: How do you make it so that an in game menu is to upon closing, continue where it left off.
If you're calling the screen, it should resume where the story is:
It behaves like calling a label where a pointer is added to a stack and returns to it once the screen is dismissed.
However since you've already bind a key to this menu screen - I'm guessing you've got an invisible screen (or another screen that's onscreen at all times) with the key binding mapped? You can't call a screen from within a screen, so you'll probably need to do something a bit different.
We probably need to see a bit more code to see how you're triggering the screen and the general control flow to see how best to do it.
Code: Select all
call screen in_game_menu
However since you've already bind a key to this menu screen - I'm guessing you've got an invisible screen (or another screen that's onscreen at all times) with the key binding mapped? You can't call a screen from within a screen, so you'll probably need to do something a bit different.
We probably need to see a bit more code to see how you're triggering the screen and the general control flow to see how best to do it.
Re: How do you make it so that an in game menu is to upon closing, continue where it left off.
This is what I've done so far, I think I've almost got it figured out, but am still lacking a few things.
Code: Select all
init python:
def show_igame_menu():
if player_has_item == True:
renpy.call_in_new_context("display_igame_menu")
config.keymap["open_igame_menu"] = ["m"]
config.underlay.append(renpy.Keymap(open_igame_menu=show_igame_menu))
label display_igame_menu:
call screen my_igame_menu
-------------------------------------------------------------------------------------------------------
screen my_igame_menu():
text "Placeholder"
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3791
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: How do you make it so that an in game menu is to upon closing, continue where it left off.
What is the exact purpose of this screen? Because there are some far simpler ways to do what I think you are attempting to do.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: How do you make it so that an in game menu is to upon closing, continue where it left off.
Ah this screen functions as an ingame menu, that can be opened at any time in the game.
Re: How do you make it so that an in game menu is to upon closing, continue where it left off.
Ah this screen functions as an ingame menu, that can be opened at any time in the game.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3791
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: How do you make it so that an in game menu is to upon closing, continue where it left off.
Yes, but what for? What I mean is what does the user see/do on said screen?
Could you simply not do something like "show" the screen by pressing the keybinding and place a button on the screen that has the action Hide("my_screen")
The screen should have modal True if this is the case.
As an example, here is a screen I use as my in-game menu:
I have it set so that a user can press any of the usual buttons and if on an Android device, swipe the screen down then up to show/hide the menu.
By closing the menu, the user returns to the exact point they came from (because they never actually left) I achieve this by adding the hide function to all the actions of each button (that should hide the menu) and also having a button on the screen:
specifically for closing the screen.
Could you simply not do something like "show" the screen by pressing the keybinding and place a button on the screen that has the action Hide("my_screen")
The screen should have modal True if this is the case.
As an example, here is a screen I use as my in-game menu:
Code: Select all
screen navi_drop():
modal True
zorder 50
style_prefix "navi_drop"
frame at navigation_appear:
has vbox
ysize 1180
ymaximum 1180
grid 1 6:
spacing 50
imagebutton alt "save" hover "gui/button/save.png" idle "gui/button/save.png" focus_mask True action ShowMenu("save"), Hide("navi_drop")
imagebutton alt "load" hover "gui/button/load.png" idle "gui/button/load.png" focus_mask True action ShowMenu("load"), Hide("navi_drop")
imagebutton alt "options" hover "gui/button/options.png" idle "gui/button/options.png" focus_mask True action ShowMenu("preferences"), Hide("navi_drop")
imagebutton alt "about" hover "gui/button/about.png" idle "gui/button/about.png" focus_mask True action ShowMenu("about"), Hide("navi_drop")
imagebutton alt "achievements" hover "gui/button/achievements.png" idle "gui/button/achievements.png" focus_mask True action ShowMenu("achievements"), Hide("navi_drop")
imagebutton alt "main menu" hover "gui/button/main.png" idle "gui/button/main.png" focus_mask True action renpy.full_restart
fixed:
add "gui/header.jpg"
# add [menu_text]:
# xalign 0.5
# ypos 25
imagebutton alt "menu" hover "gui/button/menu.png" idle "gui/button/menu.png" action Hide("navi_drop")
transform navigation_appear:
on show:
ypos -1280
linear .36 ypos 100
on hide:
linear .36 ypos -1280
style navi_drop_frame:
background Frame(gui.main_menu_base, gui.navi_drop_frame_borders, tile=gui.frame_tile)
padding gui.navi_drop_frame_borders.padding
xpos gui.navi_drop_menu_xpos
ypos gui.navi_drop_menu_ypos
#default menu_text = gui.menu_achievement_text
By closing the menu, the user returns to the exact point they came from (because they never actually left) I achieve this by adding the hide function to all the actions of each button (that should hide the menu) and also having a button on the screen:
Code: Select all
imagebutton alt "menu" hover "gui/button/menu.png" idle "gui/button/menu.png" action Hide("navi_drop")
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: How do you make it so that an in game menu is to upon closing, continue where it left off.
Ah yeah, my in-game menu functions extremely similarly to yours, with the option to save, load , options - so forth. With this as a reference, and with adding a few modifications, this should work in place of what I was trying to do. Thanks for the help! Greatly appreciate it, I am quite new to this.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]