Page 4 of 4

Re: Writing answers instead of choosing menu options

Posted: Mon Aug 19, 2013 11:47 am
by xavimat
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).

Re: Writing answers instead of choosing menu options

Posted: Mon Aug 19, 2013 12:06 pm
by Kokoro Hane
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?

Re: Writing answers instead of choosing menu options

Posted: Mon Aug 19, 2013 10:57 pm
by TrickWithAKnife
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].

Re: Writing answers instead of choosing menu options

Posted: Tue Aug 20, 2013 7:56 am
by xavimat
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"?

Re: Writing answers instead of choosing menu options

Posted: Sun Aug 25, 2013 12:53 pm
by jw2pfd
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.

Re: Writing answers instead of choosing menu options

Posted: Tue Aug 27, 2013 10:46 pm
by Kokoro Hane
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...

Re: Writing answers instead of choosing menu options

Posted: Sun Sep 15, 2013 9:01 pm
by Kokoro Hane
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).

Re: Writing answers instead of choosing menu options [EDITED

Posted: Thu Nov 14, 2013 11:54 am
by xavimat
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.

Re: Writing answers instead of choosing menu options [EDITED

Posted: Fri Nov 22, 2013 1:28 pm
by rabcor
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.)

Re: Writing answers instead of choosing menu options [EDITED

Posted: Fri Nov 22, 2013 2:24 pm
by xavimat
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. :)

Re: Writing answers instead of choosing menu options [EDITED

Posted: Sun Dec 29, 2013 11:31 am
by finnlawrence
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.

Re: Writing answers instead of choosing menu options [EDITED

Posted: Sun Dec 29, 2013 11:44 am
by xavimat
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.