Including a python Text Adventure in a VN?
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.
Including a python Text Adventure in a VN?
I've come up with a short, simple text adventure game (a la Zork) that I would like to include in a visual novel I'm working on. Basically I want to have a menu option in Ren'Py that when clicked on pulls up the game. Then, once the (text adventure) game is finished, it returns to the visual novel.
I know there is Renpygame for including games made with pygame in Ren'Py, but this TA game I have is just straight made with python. Is there a way to incorporate it?
I have attached the file if anyone would like to take a look. I know Ren'Py can accept Python commands, but I don't know about running something like this. I thought it might be possible to include the TA game as a separate file and give Ren'Py the instruction to run it but I don't know if that's possible. This is the first thing I've ever written in Python and I'm kinda lost
I know there is Renpygame for including games made with pygame in Ren'Py, but this TA game I have is just straight made with python. Is there a way to incorporate it?
I have attached the file if anyone would like to take a look. I know Ren'Py can accept Python commands, but I don't know about running something like this. I thought it might be possible to include the TA game as a separate file and give Ren'Py the instruction to run it but I don't know if that's possible. This is the first thing I've ever written in Python and I'm kinda lost
- Attachments
-
- Hide and Seek.py
- Python Text Adventure game.
- (4.37 KiB) Downloaded 185 times
Re: Including a python Text Adventure in a VN?
I did read the documentation, but when I try importing the module I get an error "EOFError: EOF When reading a line". If I comment out the $ import the Ren'Py part works fine, but when I include it I get that error before it even launches.Karl_C wrote:Did you read Ren'Py's documentation already?
Python Modules in Ren'Py
Python and Ren'Py
I'm wondering if it's having trouble importing it because the module runs through a Python Shell and Ren'Py doesn't have a way to process that?
-
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: Including a python Text Adventure in a VN?
Your game is using Python functions that generally should not be used from within Ren'Py; looking at it quickly, I spotted sleep(), raw_input(), and print(). (The use of raw_input() is probably causing the exception.) To convert it, you probably want to get rid of the sleep() calls, replace the raw_input() calls with calls to renpy.input(), and replace the calls to print() with calls to renpy.store.narrator(), or something along those lines.
Re: Including a python Text Adventure in a VN?
That has stopped it crashing, thank you!apricotorange wrote:Your game is using Python functions that generally should not be used from within Ren'Py; looking at it quickly, I spotted sleep(), raw_input(), and print(). (The use of raw_input() is probably causing the exception.) To convert it, you probably want to get rid of the sleep() calls, replace the raw_input() calls with calls to renpy.input(), and replace the calls to print() with calls to renpy.store.narrator(), or something along those lines.
Now it can mostly load the game. All it shows in Ren'Py is the "What do you do?" Question and prompt for input, but none of the other stuff. I was able to move around and 'seek', but it didn't tell me what I was doing. I figure I just have to tweak it for Ren'Py now that it's loading the module without crashing, maybe work something out in NVL mode.
EDIT: Looking at it again, it seems Ren'Py isn't showing anything printed with renpy.store.say (I changed it to this instead of renpy.store.narrator as narrator was causing errors) but it is showing the line printed with renpy.store.input
-
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: Including a python Text Adventure in a VN?
Not sure what's going on... the general documentation is http://www.renpy.org/doc/html/statement ... lents.html .
Re: Including a python Text Adventure in a VN?
I have uploaded the new python code that loads without crashing, and a Ren'Py game that loads the module. If you run it you can see that it displays the "What do you do now?" line from the module, and accepts input, but does not print any of the text from the game. I'm stumped
The module actually functions, you can move around to the different areas and if you type 'seek' in each one you will eventually win the game (Which closes Ren'Py, though it's not supposed to, but I'll figure that out when it comes to it). The module is running successfully, it's just not printing any of the stuff it should be. Which is kinda important for a Text Adventure game.
The module actually functions, you can move around to the different areas and if you type 'seek' in each one you will eventually win the game (Which closes Ren'Py, though it's not supposed to, but I'll figure that out when it comes to it). The module is running successfully, it's just not printing any of the stuff it should be. Which is kinda important for a Text Adventure game.
- Attachments
-
- hsrenpy.py
- Text Adventure code slightly modified to work in Ren'Py (This version will not work outside Ren'Py)
- (4.67 KiB) Downloaded 160 times
-
- renpy-textadventuretest.zip
- Modified version of the Renpygame framework demo that runs my game instead (Loads the module successfully, but doesn't play right)
- (591.89 KiB) Downloaded 96 times
-
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: Including a python Text Adventure in a VN?
Code: Select all
renpy.store.say=('\nNorth')