Questions about disabling/bypassing menus and auto-saving!
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.
- Offworlder
- Regular
- Posts: 114
- Joined: Mon Aug 20, 2018 6:33 pm
- Contact:
Questions about disabling/bypassing menus and auto-saving!
For my current project, I essentially need to disable several standard functions. Due to that, I also need to make sure the player's progress is always being saved. I have several questions related to both topics, and it would be a huge help if anyone can point me in the right direction!
------
1. How would I force the game to completely bypass the main menu? Any time the application is launched, I want it to jump straight to the game itself without having to click "Start", etc.
2. How would I disable ALL other menus as well? Save/Load, Preferences, everything. I want to make sure there are no on-screen buttons for these menus, and that they can't be accessed via keyboard shortcuts (or mouse-clicks) either.
3. How do I ensure the game auto-saves anytime the window closes? This includes the player manually closing it, and the game quitting itself. I want to make sure there is only one possible auto-save at a time (with each new auto-save overwriting the last).
4. Related to the above, how do I ensure the game picks up from the auto-save when it is re-launched? Beyond that, I would like for the game to recognize when it's been re-launched by playing particular lines of dialogue.
------
I...think that's it for now. ^^;;
I wonder what sort of impression these questions give of the game? Haha...
Any and all help is greatly appreciated!
------
1. How would I force the game to completely bypass the main menu? Any time the application is launched, I want it to jump straight to the game itself without having to click "Start", etc.
2. How would I disable ALL other menus as well? Save/Load, Preferences, everything. I want to make sure there are no on-screen buttons for these menus, and that they can't be accessed via keyboard shortcuts (or mouse-clicks) either.
3. How do I ensure the game auto-saves anytime the window closes? This includes the player manually closing it, and the game quitting itself. I want to make sure there is only one possible auto-save at a time (with each new auto-save overwriting the last).
4. Related to the above, how do I ensure the game picks up from the auto-save when it is re-launched? Beyond that, I would like for the game to recognize when it's been re-launched by playing particular lines of dialogue.
------
I...think that's it for now. ^^;;
I wonder what sort of impression these questions give of the game? Haha...
Any and all help is greatly appreciated!
Last edited by Offworlder on Fri Dec 28, 2018 8:11 am, edited 2 times in total.
Re: Questions about disabling/bypassing menus and auto-saving!
1. You can put a condition for the main menu that checks if the game ran for at least once then auto jump to a specific save point.
2. For keyboard shortcuts, you can call a new screen which maps existing keyboard buttons to nothing or you can remove already existing keyboard shortcuts or you can disable keyboard input. For your buttons, you can just redefine you windows screen and whatnot and just show the text window itself.
3. You can force an autosave/quicksave at specific points without opening the saves screens.
5. Questions 5 is related to question 1, put a condition then force the game to autoload a quicksave/autosave so that your game starts there.
If you need some code, just say and I'll try to cook something up XD
2. For keyboard shortcuts, you can call a new screen which maps existing keyboard buttons to nothing or you can remove already existing keyboard shortcuts or you can disable keyboard input. For your buttons, you can just redefine you windows screen and whatnot and just show the text window itself.
3. You can force an autosave/quicksave at specific points without opening the saves screens.
5. Questions 5 is related to question 1, put a condition then force the game to autoload a quicksave/autosave so that your game starts there.
If you need some code, just say and I'll try to cook something up XD
- Offworlder
- Regular
- Posts: 114
- Joined: Mon Aug 20, 2018 6:33 pm
- Contact:
Re: Questions about disabling/bypassing menus and auto-saving!
Thanks for responding to my questions!
Unfortunately, I'm very new to coding and not quite certain how to do the various things you're suggesting. D:
I found this code, which seems to prevent the main menu from being accessed. However, the game just starts from the beginning whenever it's loaded. I'm not sure what to add to make it start from an auto-save instead.
Code: Select all
label main_menu:
return
As far as forcing an auto-save, I found this in the Ren'py documentation. But, I can't figure out how to actually implement it into the script.
Code: Select all
renpy.force_autosave(take_screenshot=False)
Re: Questions about disabling/bypassing menus and auto-saving!
Keyboard and mouse shortcuts are controlled by the “keymap”. Basically, you want to remove entries from it.
Manipulating the keymap is documented here: https://www.renpy.org/doc/html/keymap.html
Manipulating the keymap is documented here: https://www.renpy.org/doc/html/keymap.html
Re: Questions about disabling/bypassing menus and auto-saving!
Np, let me see what I can do for you XDThanks for responding to my questions!
Unfortunately, I'm very new to coding and not quite certain how to do the various things you're suggesting. D:
Paste this above label start:
Code: Select all
default persistent.menu_first_time_done = False
define config.autosave_slots = 1
screen disable_features:
key "game_menu" action NullAction()
on 'show' action SetVariable('quick_menu', False)
on 'hide' action SetVariable('quick_menu', True)
init python:
def clear_auto_saves():
auto_saves = renpy.list_saved_games()
for i in auto_saves:
if i[0].startswith('auto'):
renpy.unlink_save(i[0])
label main_menu:
if not persistent.menu_first_time_done:
$ clear_auto_saves()
call screen main_menu
else:
$ renpy.load('auto-1')
Code: Select all
label start:
$ persistent.menu_first_time_done = True
e 'random text'
Now run this code whenever you need it
Code: Select all
show screen disable_features
Hope this helps you XD If you have questions just say and I'll get to you ASAP
PS: If you want to see the menu screen again, in your renpy launcher click the Delete Persistent and it will reset the thing. Also, if you use the show screen disable_features after your game has an autosave, this may not work so you might need to delete pesistent again or run this function
Code: Select all
$ clear_auto_saves()
- Offworlder
- Regular
- Posts: 114
- Joined: Mon Aug 20, 2018 6:33 pm
- Contact:
Re: Questions about disabling/bypassing menus and auto-saving!
I actually did see that page, but I'm not quite certain I understand it. I assumed I'd be able to find "config.keymap" in "options.rpy" or "screens.rpy", but I did a general search within the entire project for "keymap" and nothing came up.rames44 wrote: ↑Fri Dec 28, 2018 1:10 pm Keyboard and mouse shortcuts are controlled by the “keymap”. Basically, you want to remove entries from it.
Manipulating the keymap is documented here: https://www.renpy.org/doc/html/keymap.html
...Or maybe I'm just misunderstanding. D:
- Offworlder
- Regular
- Posts: 114
- Joined: Mon Aug 20, 2018 6:33 pm
- Contact:
Re: Questions about disabling/bypassing menus and auto-saving!
I tried out your code and it definitely seems to solve at least some of my inquiries. The game now auto-saves upon closing, then re-loads from the auto-save without showing the main menu. Huzzah! Thank you so much!
As far as I can tell, though, no button presses are disabled. I'm still able to open the in-game menu with F1 and right-click, for example. Of note, I definitely want to make sure that certain buttons always work. For example, pressing Enter to continue and hiding the textbox. I just don't want any menus to open. No "rollback" or things like that, either.
On another note, I'm not sure how this code is meant to work:
Code: Select all
label start:
$ persistent.menu_first_time_done = True
e 'random text'
What it ended up doing was showing the "random text" line of dialogue the first time I opened the game, then never again. What I'm wanting to accomplish is for lines of dialogue to show up whenever the game is closed/re-opened, but different dialogue at different points in the game. It should happen every time the window is closed, then re-opened.
Thanks again for all of your help so far. ^^
Re: Questions about disabling/bypassing menus and auto-saving!
Change your screen disable_features to the one below
The random text was just filler and doesn't do anything. Its basically the first dialogue of your game when you start and its up to what you want.
However, change the start to the one below:
Make sure those two lines are the first thing under your start label before any other dialogue.
The code $ persistent.menu_first_time_done = True is only for the first time you run the game. Of course you want the player to see the main menu when he first plays the game and next time it will load from autosave.
Lastly, in renpy launcher click delete persistent data. This will reset the code i gavw you so there wont be any problems. Everything should be fine now XD
Code: Select all
screen disable_features:
key "game_menu" action NullAction()
key "rollback" action NullAction()
on 'show' action SetVariable('quick_menu', False)
on 'hide' action SetVariable('quick_menu', True)
However, change the start to the one below:
Code: Select all
label start:
$ persistent.menu_first_time_done = True
show screen disable_features
The code $ persistent.menu_first_time_done = True is only for the first time you run the game. Of course you want the player to see the main menu when he first plays the game and next time it will load from autosave.
Lastly, in renpy launcher click delete persistent data. This will reset the code i gavw you so there wont be any problems. Everything should be fine now XD
- Offworlder
- Regular
- Posts: 114
- Joined: Mon Aug 20, 2018 6:33 pm
- Contact:
Re: Questions about disabling/bypassing menus and auto-saving!
For the type of game I'm creating, I actually don't want the main menu screen to show at any point. Even the very first time the game is loaded.
I'm not sure why, but now none of the changes are working. x_x;
All I did was replace "screen disable_features" with the updated version you suggested, then Force Recompile (unintentionally) and Delete Persistent. Now, the game just starts as it normally would from the main menu. Instead of jumping immediately to the most recent auto-save.
Rollback and right-clicking to open the menu are both disabled, though! I'll need to find some way to disable the various keymaps as well.
Re: Questions about disabling/bypassing menus and auto-saving!
Ah, I get it. Not every bit of Ren’py will (easily) show up in your project. A good bit of it (this part included) is set up in the Python code that makes up Ren’py. That code actually hides inside the Ren’py launcher (if I’m recalling correctly) while you’re working on your project, but then gets bundled with it when you build a distribution. So it’s there, just kind of hiding in a corner. LOLOffworlder wrote: ↑Fri Dec 28, 2018 7:54 pmI actually did see that page, but I'm not quite certain I understand it. I assumed I'd be able to find "config.keymap" in "options.rpy" or "screens.rpy", but I did a general search within the entire project for "keymap" and nothing came up.rames44 wrote: ↑Fri Dec 28, 2018 1:10 pm Keyboard and mouse shortcuts are controlled by the “keymap”. Basically, you want to remove entries from it.
Manipulating the keymap is documented here: https://www.renpy.org/doc/html/keymap.html
...Or maybe I'm just misunderstanding. D:
So, remember that .rpy files are in “Ren’py language”, and can include Python, but most of the core of Ren’py is written in “pure Python” and lurks outside of your project.
Re: Questions about disabling/bypassing menus and auto-saving!
Would you mind posting your code that way I can see what you done XDOffworlder wrote: ↑Sat Dec 29, 2018 12:21 pmFor the type of game I'm creating, I actually don't want the main menu screen to show at any point. Even the very first time the game is loaded.
I'm not sure why, but now none of the changes are working. x_x;
All I did was replace "screen disable_features" with the updated version you suggested, then Force Recompile (unintentionally) and Delete Persistent. Now, the game just starts as it normally would from the main menu. Instead of jumping immediately to the most recent auto-save.
Rollback and right-clicking to open the menu are both disabled, though! I'll need to find some way to disable the various keymaps as well.
- Offworlder
- Regular
- Posts: 114
- Joined: Mon Aug 20, 2018 6:33 pm
- Contact:
Re: Questions about disabling/bypassing menus and auto-saving!
I apologize for taking so long to respond! My family's holiday celebrations were held a bit late, so I've been pretty busy the past few days. Now it's back to devving!
rames44:
Knowing that the file(s) I need lurk somewhere outside of the project makes everything even more confusing, honestly.
I really have no idea where to look. D:
Enchant00:
I was early enough in development that I decided to just re-start the project from scratch. Hopefully, that'll fix whatever mysterious issue caused everything to break. I'm going to play around with the code for a bit, see if I can get it to work the way I'm imagining. Thanks a ton for all of your help!
I'll make another thread if I get stuck again. >_o
rames44:
Knowing that the file(s) I need lurk somewhere outside of the project makes everything even more confusing, honestly.
I really have no idea where to look. D:
Enchant00:
I was early enough in development that I decided to just re-start the project from scratch. Hopefully, that'll fix whatever mysterious issue caused everything to break. I'm going to play around with the code for a bit, see if I can get it to work the way I'm imagining. Thanks a ton for all of your help!
I'll make another thread if I get stuck again. >_o
Who is online
Users browsing this forum: geoWaffle