Writing answers instead of choosing menu options [EDITED]

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Writing answers instead of choosing menu options

#46 Post by xavimat » Mon Aug 19, 2013 11:47 am

jw2pfd wrote:I hope my rambling answered your question in some capacity.
Yes, thanks.
I, indeed, enjoyed the game this way. I wrote sentences knowing that I was "playing" like an actor (or like in life-role-playing).

@TrickWithAKnife: I can imagine a game in which the responses of the player affect, for example, stats. But the "complexity of language" (as jw2pfd points out) makes it very difficult. Maybe it could be done with hints to the user (words that he/she knows that affect one stat or another).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Kokoro Hane
Eileen-Class Veteran
Posts: 1014
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, Crystal Captor: Memory Chronicle Finale, Journey of The Scroll, An Encounter ~In The Rain~, A Piece of Sweetness
Projects: Gakusei, Final Pirate Haven: Rebellion of Gilfer's Bay, False Hope, Final Chance
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

Re: Writing answers instead of choosing menu options

#47 Post by Kokoro Hane » Mon Aug 19, 2013 12:06 pm

Hi! I am having a problem with the code.

It seems that now I have it in my project, the choice menus don't work anymore. When I go back to my saved games with choice menus, an error comes up saying "reply_screen" not defined. Does this code replace the choice menu function? Because when I use $ menu = nvl _menu, it works just find (since I use nvl_menu for the yielded search results). Is there a way where I can still have my regular choice menu and the reply code?
PROJECTS:
Journey of The Scroll[COMPLETE][RPG][v.2]
An Encounter ~In The Rain~ [COMPLETE][IntRenAiMo'19]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]
The Only One Girl [WiP][Up.5/20/2017][1stQ ver. released]
30 Kilowatt Hours Left [COMPLETE][GameJolt GDC Jam2016]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

User avatar
TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Writing answers instead of choosing menu options

#48 Post by TrickWithAKnife » Mon Aug 19, 2013 10:57 pm

xavimat wrote:
jw2pfd wrote:I hope my rambling answered your question in some capacity.
Yes, thanks.
I, indeed, enjoyed the game this way. I wrote sentences knowing that I was "playing" like an actor (or like in life-role-playing).

@TrickWithAKnife: I can imagine a game in which the responses of the player affect, for example, stats. But the "complexity of language" (as jw2pfd points out) makes it very difficult. Maybe it could be done with hints to the user (words that he/she knows that affect one stat or another).
Of course, especially with a language like English, but there are things that are possible to increase the chances of the input being understood. Even better, if the code is freely available to use and build upon, it should gradually become more effective.

One thing is for certain: users are going to write weird things that you'll never expect.

Example:
Game: "Would you like to go to a park, beach or mountain?"
Expected response: "I want to go to a mountain."
Actually response: "I'd like to go somewhere cold."
If the three keywords contained key information it might be possible. Beach could contain [sand, ocean, sea, hot], park could contain [trees, grass, hill, green], mountain could contain [white, cold, snow, ice, skiing].
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Writing answers instead of choosing menu options

#49 Post by xavimat » Tue Aug 20, 2013 7:56 am

Kokoro Hane wrote:Hi! I am having a problem with the code.

It seems that now I have it in my project, the choice menus don't work anymore. When I go back to my saved games with choice menus, an error comes up saying "reply_screen" not defined. Does this code replace the choice menu function? Because when I use $ menu = nvl _menu, it works just find (since I use nvl_menu for the yielded search results). Is there a way where I can still have my regular choice menu and the reply code?
I don't know why you have this error.
This code only uses "renpy.input()", not the "choice menu". And it doesn't change nor define screens. It uses the defined "input" screen.
Are you calling a "reply screen"?
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

jw2pfd
Regular
Posts: 87
Joined: Tue Sep 18, 2012 9:55 pm
Location: DFW, TX, USA
Contact:

Re: Writing answers instead of choosing menu options

#50 Post by jw2pfd » Sun Aug 25, 2013 12:53 pm

Okay, so, I decided to rebuild a system that checks for keywords and synonyms from the ground up. I feel that it's off to a better start than what I had coded in The Dolls' Stories. My code for that project was too specific to its purposes. I have attached a zip of two script files that can simply be pasted into a new project's game folder if you want to launch and test it. The .rpy files themselves are commented a bunch, but there isn't a lot of explanation in the project itself as of right now.

The purpose of this code is not to replace xavimat's code in the original post. My code essentially does the same thing, but I wanted to add the feature of assigning words synonyms or equivalent statements. I felt that the best way to do that was to implement the code using classes which meant doing entirely new code as opposed to augmenting xavimat's code. I know Trick was suggesting this functionality, but I am not sure how many other people will really utilize these features.

I didn't really feel like my code warranted a new thread given that it's a part of this thread's discussion.
Attachments
sentence-1.0.zip
sentence.rpy - contains class code
script.rpy - a file utilizing class code for example purposes
(5.11 KiB) Downloaded 108 times

User avatar
Kokoro Hane
Eileen-Class Veteran
Posts: 1014
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, Crystal Captor: Memory Chronicle Finale, Journey of The Scroll, An Encounter ~In The Rain~, A Piece of Sweetness
Projects: Gakusei, Final Pirate Haven: Rebellion of Gilfer's Bay, False Hope, Final Chance
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

Re: Writing answers instead of choosing menu options

#51 Post by Kokoro Hane » Tue Aug 27, 2013 10:46 pm

xavimat wrote:
Kokoro Hane wrote:Hi! I am having a problem with the code.

It seems that now I have it in my project, the choice menus don't work anymore. When I go back to my saved games with choice menus, an error comes up saying "reply_screen" not defined. Does this code replace the choice menu function? Because when I use $ menu = nvl _menu, it works just find (since I use nvl_menu for the yielded search results). Is there a way where I can still have my regular choice menu and the reply code?
I don't know why you have this error.
This code only uses "renpy.input()", not the "choice menu". And it doesn't change nor define screens. It uses the defined "input" screen.
Are you calling a "reply screen"?
Hmm, I'll have to check the code and see what I did...
PROJECTS:
Journey of The Scroll[COMPLETE][RPG][v.2]
An Encounter ~In The Rain~ [COMPLETE][IntRenAiMo'19]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]
The Only One Girl [WiP][Up.5/20/2017][1stQ ver. released]
30 Kilowatt Hours Left [COMPLETE][GameJolt GDC Jam2016]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

User avatar
Kokoro Hane
Eileen-Class Veteran
Posts: 1014
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, Crystal Captor: Memory Chronicle Finale, Journey of The Scroll, An Encounter ~In The Rain~, A Piece of Sweetness
Projects: Gakusei, Final Pirate Haven: Rebellion of Gilfer's Bay, False Hope, Final Chance
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

Re: Writing answers instead of choosing menu options

#52 Post by Kokoro Hane » Sun Sep 15, 2013 9:01 pm

Just want to let you know I discovered the problem, and it had nothing to do with this code, but another code I was using (simple fix; a certain flag had to be set underneath the Start label).
PROJECTS:
Journey of The Scroll[COMPLETE][RPG][v.2]
An Encounter ~In The Rain~ [COMPLETE][IntRenAiMo'19]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]
The Only One Girl [WiP][Up.5/20/2017][1stQ ver. released]
30 Kilowatt Hours Left [COMPLETE][GameJolt GDC Jam2016]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Writing answers instead of choosing menu options [EDITED

#53 Post by xavimat » Thu Nov 14, 2013 11:54 am

Edited code. Now we have the two functions reply() and reply2() that return a single word and a list respectively.
Added also a link to jw2pfd's code.
Check the OP here: http://lemmasoft.renai.us/forums/viewto ... 93#p266393
Thanks to all who have contributed to this.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
rabcor
Regular
Posts: 81
Joined: Sun Mar 17, 2013 3:07 pm
Projects: None (Need a programmer?)
Organization: Cestarian Games
Contact:

Re: Writing answers instead of choosing menu options [EDITED

#54 Post by rabcor » Fri Nov 22, 2013 1:28 pm

That's pretty cool, i had thought about using something similar in my current project, but still haven't decided. Thanks for the code :D

My idea of it was inspired by wizardry 8 (Lower right corner, there's a textbox for the player to write in, he can select to "talk about" or "where is" what he typed in, any dialogues that actually work get added to the list above the textbox. When critcal Yes/No choices happen in dialogue it uses a "Yes/No" menu, VN style.)

User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Writing answers instead of choosing menu options [EDITED

#55 Post by xavimat » Fri Nov 22, 2013 2:24 pm

rabcor wrote:That's pretty cool, i had thought about using something similar in my current project, but still haven't decided. Thanks for the code :D
My idea of it was inspired by wizardry 8 (Lower right corner, there's a textbox for the player to write in, he can select to "talk about" or "where is" what he typed in, any dialogues that actually work get added to the list above the textbox. When critcal Yes/No choices happen in dialogue it uses a "Yes/No" menu, VN style.)
You're welcome!

I haven't played that (seems pretty complex).
If you have a (simple) suggestion, maybe I can try. :)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
finnlawrence
Newbie
Posts: 11
Joined: Mon Dec 24, 2012 11:35 am
Contact:

Re: Writing answers instead of choosing menu options [EDITED

#56 Post by finnlawrence » Sun Dec 29, 2013 11:31 am

Is there any way to adjust this code so that you can put a jump statement in place of saying something? For example, if you wanted to jump to a 'game over' screen if the player typed in the wrong answer.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Writing answers instead of choosing menu options [EDITED

#57 Post by xavimat » Sun Dec 29, 2013 11:44 am

finnlawrence wrote:Is there any way to adjust this code so that you can put a jump statement in place of saying something? For example, if you wanted to jump to a 'game over' screen if the player typed in the wrong answer.
Easy!
I suggest a simple way. Change this lines:

Code: Select all

            if found_it == "":
                renpy.say(invalid_character, invalid_answer)
With this:

Code: Select all

            if found_it == "":
                found_it = "WRONG"
Then, the function will return the word WRONG if no keyword is found in the player's entry.
With if-elif-else, you can jump or call what you need.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Google [Bot]