How to make a .txt file depending on the renpy.input?
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.
-
- Newbie
- Posts: 4
- Joined: Wed Jul 25, 2018 7:03 pm
- Projects: Akai Ito - The Red String of Destiny
- Organization: Night Shift Studios
- Location: Argentina
- Contact:
How to make a .txt file depending on the renpy.input?
Hi! I got a question to make about creating a .txt file depending on which name you input at the beggining of game.
It's for an Easter Egg, like if you put as your name: "Michael" , it writes a .txt file with a short story.
I'd like to know how to ask whats the current renpy.input and how to write the .txt file.
Thank you very much!
(Sorry for my english, It's not my dominant language)
It's for an Easter Egg, like if you put as your name: "Michael" , it writes a .txt file with a short story.
I'd like to know how to ask whats the current renpy.input and how to write the .txt file.
Thank you very much!
(Sorry for my english, It's not my dominant language)
- erickcire95
- Regular
- Posts: 33
- Joined: Tue Dec 26, 2017 7:38 pm
- Contact:
Re: How to make a .txt file depending on the renpy.input?
First you have to store the input in a variable. Something like:
Then, create a txt file using python's open function with mode "w" (writting):
Where:
"Name of the file" will be the file name that is created.
character_name is the variable where you stored the player's input.
"Some text " & " some more text" are the text that you want to put inside the txt file.
Code: Select all
character_name = renpy.input("What's your name?")
Code: Select all
python:
with open("Name of the file.txt","w") as egg:
egg.write("Some text " + character_name + " some more text")
egg.closed
"Name of the file" will be the file name that is created.
character_name is the variable where you stored the player's input.
"Some text " & " some more text" are the text that you want to put inside the txt file.
Re: How to make a .txt file depending on the renpy.input?
Sorry for off topic!erickcire95 wrote: ↑Thu Jul 26, 2018 2:52 am First you have to store the input in a variable. Something like:
Then, create a txt file using python's open function with mode "w" (writting):Code: Select all
character_name = renpy.input("What's your name?")
Where:Code: Select all
python: with open("Name of the file.txt","w") as egg: egg.write("Some text " + character_name + " some more text") egg.closed
"Name of the file" will be the file name that is created.
character_name is the variable where you stored the player's input.
"Some text " & " some more text" are the text that you want to put inside the txt file.
This looks amazing, can I ask is there any more possible "eggs" in renpy engine to make?
of the people for the people
-
- Newbie
- Posts: 4
- Joined: Wed Jul 25, 2018 7:03 pm
- Projects: Akai Ito - The Red String of Destiny
- Organization: Night Shift Studios
- Location: Argentina
- Contact:
Re: How to make a .txt file depending on the renpy.input?
It worked! Thank you very much!erickcire95 wrote: ↑Thu Jul 26, 2018 2:52 am First you have to store the input in a variable. Something like:
Then, create a txt file using python's open function with mode "w" (writting):Code: Select all
character_name = renpy.input("What's your name?")
Where:Code: Select all
python: with open("Name of the file.txt","w") as egg: egg.write("Some text " + character_name + " some more text") egg.closed
"Name of the file" will be the file name that is created.
character_name is the variable where you stored the player's input.
"Some text " & " some more text" are the text that you want to put inside the txt file.
- erickcire95
- Regular
- Posts: 33
- Joined: Tue Dec 26, 2017 7:38 pm
- Contact:
Re: How to make a .txt file depending on the renpy.input?
Well... This question is very hard to answer. The simplest answer is: Yes. you can make a lot of easter eggs in Ren'py, but I don't know ecaxtly what you are looking for. Could you be a little more precise?
Re: How to make a .txt file depending on the renpy.input?
To be honest...I can't tell right now what I want to do.....perhaps you have some examples? What possible renpy can generate?erickcire95 wrote: ↑Sun Jul 29, 2018 7:21 pmWell... This question is very hard to answer. The simplest answer is: Yes. you can make a lot of easter eggs in Ren'py, but I don't know ecaxtly what you are looking for. Could you be a little more precise?
of the people for the people
Re: How to make a .txt file depending on the renpy.input?
Wonderful help! Also, I would like a similar code. Just a difference, could the player's message be put in the text file instead of that? It's also quite an easter egg. Though this is another code, I am using python to verify if the player's message has certain words, and if it has, it will open a secret ending or something like that. But for that, I must somehow put player's message in a .txt file.
Who is online
Users browsing this forum: Lucyper, Majestic-12 [Bot]