Hello it's me again! I have a few questions:
1) Is there any chance to customize the crash screen? When running the game, if there's a python block that doesn't work, it crashes. Is there a way to change what this shows, including text and all? (The reason is that I'm making a game where the player writes python commands and the game parses and executes them. It catches syntax errors, but not runtime errors, and the latter force the game to crash)
2) Continuing in this, is there a way for any python script to run, but its runtime errors NOT affect renpy? I assume no, since essentially renpy is running them, therefore renpy crashes, therefore we go to question 1... but you never know!
3) My workaround that I'm considering is to write it up out of the game (already done that), call it up out of the game with a command (but not THROUGH renpy), and get the results again (probably printed in another file that renpy reads). Is that doable?
Thank you!
Feel free to ask for clarifications about my questions if you'd like to help, I admit that plenty of things are not obvious as to why I want to do this: the reason is I'm making an educational game that's supposed to teach kids python, so it's a visual novel where at times they have to write up a small, very python program.
If the program works fine, then renpy executes it just fine!
If the program has SyntaxErrors, then I've got a nice function using ast.parse that spots them, so we're all good and dandy.
But when it comes to runtime errors... I don't know what to do, it crashes Renpy
Runtime Errors & Custom Crash Screen
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.
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: Runtime Errors & Custom Crash Screen
That is much very similar to the RenPy tutorial... showing script examples. How about you dig into its script and look for the examples? The tutorial has many rpy scripts unfortunately... maybe you can try just don't do anything that could break the renpy tutorual. That's all i know.
Re: Runtime Errors & Custom Crash Screen
Ok, I tried the following:
I assume that I can also name other errors, should cover most basic stuff. Is there a better solution? This works... for now.
Code: Select all
try:
renpy.python.py_exec(program)
except NameError:
print("Runtime Error")
Who is online
Users browsing this forum: Bing [Bot]