Hi, I am very new to Ren'Py and want to achieve something like a learning game for adults working in cultural heritage.
The dialogue and GUI functions are all working nicely and development with Ren'Py is fast.
What I mean to do in addition to let people play an educational game is to use the dialogue system like a survey - this means I need to get the answers of users sent to me.
Is there any way to achieve this, i.e. export the text history? Ideally it would only export the choices, at a time the user decides they want to send the feedback.
I hope you understand what my idea is about and that someone can help me!
(I've tried working with Ink and Unity, but Unity is much too complex to develop a rather simple 2D text adventure)
Thank you!
Export choices
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.
Re: Export choices
Answering my own question:
1) Create a list with choice answers
2) Creating a file and appending the list (not used, maybe for save keeping of stuff)
3) sending Email with choices (called when game finishes)
1) Create a list with choice answers
Code: Select all
label start:
python:
choice_list = []
Code: Select all
label question1:
menu:
w "Question"
"Answer":
$ role = "Answer"
jump question2
label question2:
python:
choice_list.append("1: "+role)
...
Code: Select all
init python:
import codecs
for item in choice_list:
with codecs.open(config.basedir+"/my_file.txt", "a+", "utf-8") as t:
t.write(item +"\r\n")
Code: Select all
init python:
def send_email():
body = '%0D'.join(choice_list) #with carriage return for new line
import webbrowser
webbrowser.open_new("mailto:example@email.com&subject=KuKuRisk-Fragebogen&body="+body)
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Export choices
I use codecs a lot. If you need only the answers in a standard way (for example: 1:a, 2:b, 3:a, 4:c...) you don't need codecs (because there is no need of utf-8), and can use simply with open(...).
You could use another way. RenPy can send info directly to a database:
use urllib2.urlopen (obviously import urllib2), and append the data to it.
You'll need your own hosting with a database, and program a php page to store the info in your database.
You could use another way. RenPy can send info directly to a database:
use urllib2.urlopen (obviously import urllib2), and append the data to it.
You'll need your own hosting with a database, and program a php page to store the info in your database.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Re: Export choices
Wow!
Thank you for the DB hint! That would be awesome, I'll check it out!
At the moment I got back to using codecs because the email body string is not working correctly - sometimes it stops. could be because of special characters.
I use codecs because I use full answer strings for the list elements, and the language is German.
Works like a charm. I was not sure how to best send an email with an attachment (my generated txt file) but the database connection might be my saviour!
thanks so much!
Thank you for the DB hint! That would be awesome, I'll check it out!
At the moment I got back to using codecs because the email body string is not working correctly - sometimes it stops. could be because of special characters.
I use codecs because I use full answer strings for the list elements, and the language is German.
Works like a charm. I was not sure how to best send an email with an attachment (my generated txt file) but the database connection might be my saviour!
thanks so much!
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Export choices
I was thinking that you don't actually need a database, only a server with php able to send emails.
Make renpy send the info with urllib2.urlopen, and the php receive the info, sanitize the input (htmlentities or so), and build and send an email with the php mail function.
Make renpy send the info with urllib2.urlopen, and the php receive the info, sanitize the input (htmlentities or so), and build and send an email with the php mail function.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Re: Export choices
Thank you xavimat, that was really helpful for the survey response.
For some weird reason I also want to save the full dialogue and choices the user made, to keep for the user - just like they show in delta's readback module.
I see two ways:
a) get what the readback text history shows in a variable and put it into a txt file
b) add the user choices to _history_list
Can anyone help me to achieve either of these, please?
For some weird reason I also want to save the full dialogue and choices the user made, to keep for the user - just like they show in delta's readback module.
I see two ways:
a) get what the readback text history shows in a variable and put it into a txt file
b) add the user choices to _history_list
Can anyone help me to achieve either of these, please?
Who is online
Users browsing this forum: fufuffiero, Sugar_and_rice