Page 1 of 1

How to make a .txt file depending on the renpy.input?

Posted: Wed Jul 25, 2018 7:09 pm
by MystikGaming
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)

Re: How to make a .txt file depending on the renpy.input?

Posted: Thu Jul 26, 2018 2:52 am
by erickcire95
First you have to store the input in a variable. Something like:

Code: Select all

character_name = renpy.input("What's your name?")
Then, create a txt file using python's open function with mode "w" (writting):

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
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.

Re: How to make a .txt file depending on the renpy.input?

Posted: Sat Jul 28, 2018 1:50 pm
by Minuteman
erickcire95 wrote: Thu Jul 26, 2018 2:52 am First you have to store the input in a variable. Something like:

Code: Select all

character_name = renpy.input("What's your name?")
Then, create a txt file using python's open function with mode "w" (writting):

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
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.
Sorry for off topic!
This looks amazing, can I ask is there any more possible "eggs" in renpy engine to make?

Re: How to make a .txt file depending on the renpy.input?

Posted: Sat Jul 28, 2018 6:56 pm
by MystikGaming
erickcire95 wrote: Thu Jul 26, 2018 2:52 am First you have to store the input in a variable. Something like:

Code: Select all

character_name = renpy.input("What's your name?")
Then, create a txt file using python's open function with mode "w" (writting):

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
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.
It worked! Thank you very much!

Re: How to make a .txt file depending on the renpy.input?

Posted: Sun Jul 29, 2018 7:21 pm
by erickcire95
Minuteman wrote: Sat Jul 28, 2018 1:50 pm Sorry for off topic!
This looks amazing, can I ask is there any more possible "eggs" in renpy engine to make?
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?

Posted: Mon Jul 30, 2018 12:37 pm
by Minuteman
erickcire95 wrote: Sun Jul 29, 2018 7:21 pm
Minuteman wrote: Sat Jul 28, 2018 1:50 pm Sorry for off topic!
This looks amazing, can I ask is there any more possible "eggs" in renpy engine to make?
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?
To be honest...I can't tell right now what I want to do.....perhaps you have some examples? What possible renpy can generate?

Re: How to make a .txt file depending on the renpy.input?

Posted: Mon Feb 18, 2019 4:24 pm
by MisakiCRT
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.