Hello, I am new to here (sorry for the bad english, this is not my first language)
Currently, I am working on a game which kinda like DDLC.
The player have to delete a file and the game should be able to know and show some dialogue like "oh you deleted me".
I use the renpy.loadable("file") to make these work, but its not working well as i have to reload the script in order to let the game knows the file is missing.
So, I use renpy.reload_script() function before the if loadable statement to force the game to reload.
However, this function makes the game gets stuck. It just keeps reloading the script and saving the game(the screen keep refreshing, I m not sure).
I am wondering if I use reload_script wrong or is there a better way to do this?
sorry for my bad English again...
Problem with renpy.reload_script
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.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Problem with renpy.reload_script
I'd suggest not doing this. If you're going to look for the existence or absence of a file, a reasonable way to do it is:
The renpy.reload_script function is developer functionality, and I'm not going to support is as part of an actual game mechanic. (And deleting .rpy files is similarly forbidden - Ren'Py caches and uses them, and I don't want to support games that remove content from a released game at runtime.)
Code: Select all
init python:
import os
while os.path.exists(os.path.join(config.basedir, "game/fakeout.txt")):
"You didn't delete me!"
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: Problem with renpy.reload_script
Thanks! This is much better!PyTom wrote: ↑Sun Apr 08, 2018 2:28 pm I'd suggest not doing this. If you're going to look for the existence or absence of a file, a reasonable way to do it is:
The renpy.reload_script function is developer functionality, and I'm not going to support is as part of an actual game mechanic. (And deleting .rpy files is similarly forbidden - Ren'Py caches and uses them, and I don't want to support games that remove content from a released game at runtime.)Code: Select all
init python: import os while os.path.exists(os.path.join(config.basedir, "game/fakeout.txt")): "You didn't delete me!"
Who is online
Users browsing this forum: Bing [Bot]