Search found 17 matches
- Thu May 13, 2021 8:26 am
- Forum: Ren'Py Questions and Announcements
- Topic: User-defined functions and save/load
- Replies: 3
- Views: 874
Re: User-defined functions and save/load
Normally, with no other reference of the function except the player writing it, if I load without exiting it's fine, but if I load after opening the game after exiting then I get the load error (the first one). I'm not looking for something extremely elegant as a solution, even a crude workaround wo...
- Tue May 11, 2021 2:55 pm
- Forum: Ren'Py Questions and Announcements
- Topic: User-defined functions and save/load
- Replies: 3
- Views: 874
User-defined functions and save/load
Hey guys! Been a long time since I hit a wall. Long story short, I've made an educational VN teaching Python. In it, players write Python code, which Ren'Py then executes. So far it's working swell, but I hit the following bump I can't get my head around: One challenge involves writing a simple func...
- Tue Jan 26, 2021 5:41 pm
- Forum: Ren'Py Questions and Announcements
- Topic: Maximum Recursion Error when Loading game
- Replies: 2
- Views: 347
Re: Maximum Recursion Error when Loading game
I wouldn't expect manipulating sys.stdout like that to work. Actually, it works just fine (both this and a previous way I tried). :oops: Both ways, however, create this maximum recursion issue when loading. I'm pretty sure this is the problem, having isolated it to that piece of code. :? I do not k...
- Mon Jan 25, 2021 4:10 am
- Forum: Ren'Py Questions and Announcements
- Topic: Maximum Recursion Error when Loading game
- Replies: 2
- Views: 347
Maximum Recursion Error when Loading game
Hello great people! I have a rather annoying problem I hope you can help me with. Long story short, I have created a Renpy game where players type in Python code in specific challenges, and the game runs the code and if it does what it's supposed to do, the story goes on. The game runs fine all the ...
- Mon May 18, 2020 5:19 am
- Forum: Ren'Py Questions and Announcements
- Topic: Runtime Errors & Custom Crash Screen
- Replies: 2
- Views: 285
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")
- Mon May 18, 2020 5:10 am
- Forum: Ren'Py Questions and Announcements
- Topic: Runtime Errors & Custom Crash Screen
- Replies: 2
- Views: 285
Runtime Errors & Custom Crash Screen
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 ...
- Mon May 11, 2020 3:09 pm
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
I GOT IT! It would seem that in order for this (slightly retarder way I'm going) to work, I needed to: A)ONLY exec, without compiling. B)The .py program to run, EVEN IF EXTERNAL, still needs to use the renpy file handling functions etc., it just doesn't recognize other commands and renpy crashes. TH...
- Mon May 11, 2020 2:37 pm
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
By the way, thank you for helping me, I really appreciate it!
- Mon May 11, 2020 2:36 pm
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
Nope, it prints the contents of test.py. And then I get this: I'm sorry, but an uncaught exception occurred. While running game code: File "game/script.rpy", line 75, in script python: File "game/script.rpy", line 83, in <module> renpy.python.py_exec(code) SyntaxError: invalid sy...
- Mon May 11, 2020 1:38 pm
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
And this: filename = os.path.join(renpy.config.gamedir, "texts\\test.py") with open(filename, "rb") as source_file: code = renpy.python.py_compile(source_file.read(), 'exec', filename) renpy.python.py_exec(code) does this: I'm sorry, but an uncaught exception occurred. While runn...
- Mon May 11, 2020 1:36 pm
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
Ok, quick question: If Renpy uses Python 2.7, is there a chance that the little .py program I've written is somehow NOT compatible? I mean, bloody unlikely, since we're talking about the same stuff, but is it possible that's the problem?
- Mon May 11, 2020 1:35 pm
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
I just found out it does internally. Still... filename = os.path.join(renpy.config.gamedir, "texts\\test.py") with open(filename, "rb") as source_file: renpy.python.py_exec(source_file.read()) This does nothing. ...and... filename = renpy.file("test.py") renpy.python.py...
- Mon May 11, 2020 11:53 am
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
I'm not really that good in Python to be able to make a proper game as easily as with RenPy. The idea is to have a very good game as basis, that will motivate students to play it, while at the same time actually learning Python by solving challenges.
- Mon May 11, 2020 11:33 am
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
Update: After a bit of trial an error, I got this code: filename = os.path.join(renpy.config.gamedir, "texts\\test.py") with open(filename, "rb") as source_file: code = renpy.python.py_compile(source_file.read(), filename, 'exec') renpy.python.py_exec(code) But this time, it cras...
- Mon May 11, 2020 11:26 am
- Forum: Ren'Py Questions and Announcements
- Topic: [SOLVED] Exec() not running in renpy
- Replies: 14
- Views: 618
Re: Exec() not running in renpy
The idea is the following: 1) Player writes simple program inside game (with prompts from the game for aid) 2) Game saves this program as a .py file (Already got that, fortunately) 3) Game executes this code 4) Game gets the result of the execution to continue Simple example: I have a .txt that's al...