Replying through dialogue/ Artificial Intelligence based

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
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#16 Post by isobellesophia »

Paul Kinsella wrote: Tue May 19, 2020 2:10 am
isobellesophia wrote: Tue May 19, 2020 12:40 am Read the example of my post above carefully, this one would appear if the words aren't listed in the codes.
I have read your example serval times and attempted to run it. Unfortunately I do not have the skills (yet) to understand. The best I could do was make my example as you see it. Could I trouble you to alter the example so I (and other new coders) can better understand what you want to explain. :D
Dont put a another label below this codes listed, when you typed a input, it will be automatically a label itself.

Code: Select all

define user_input=[] 
label start: 
"Welcome!" 
label user: 
$ user_input = renpy.input(prompt = "Type anything you want!", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!") 
$ user_input=user_input.lower().strip() 
if user_input == "": #This will happen if there's no input. 
"You didn't say anything. You must be the strong siolent type." 
jump user 

if user_input in ['hello','Hello','hi','Hi','howdy','Howdy','yo','Yo']: 
"Hi. Do you want to ask me anything?" 
jump user 
elif user_input in ['cow','cows','Cows','Cow','milk','Milk']: 
"That is not my cow." 
jump user 
elif user_input in ['sword of power','Sword of Power']: 
"What!?!?!??!" 
jump other

label sword: ####< Dont put this, because you already had a label above. Or, you can just create a new .rpy file instead, for several labels you want to create.

Code: Select all

label untype: 
$ randdiag = renpy.random.randint(1, 10) 
show m think with dissolve 

if randdiag == 1: 
a "Hello! Put the "label untype" below on your typed codes above, and NEVER PLACE THIS SOMEWHERE IN THE CODE. Or else it will break the dialogues. 
jump user

elif randdiag == 2: 
a "Wywisjdow is not a word!" 
jump user
I am kindly sorry for misunderstanding. This may help you now.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Paul Kinsella
Regular
Posts: 29
Joined: Sat May 02, 2020 9:53 am
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#17 Post by Paul Kinsella »

Is the code (written below) what you have in mind? If not, please feel free to alter it. Unfortunately (as it is now) if you put in gibberish such as "asgdfds3gh", or something like "That cow is nice" or "Hi there stranger" you jump to "You know of the sword of power? You must be the 'chosen one' bla bla bla..."
I wish I had the experience to make this code work. Thank you again for your efforts. :)

Code: Select all

define user_input=[]
label start:
    "Welcome!"
label user:
    $ user_input = renpy.input(prompt = "Type anything you want!", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!")
    $ user_input=user_input.lower().strip()
    if user_input == "": #This will happen if there's no input.
        "You didn't say anything. You must be the strong siolent type."
        jump user
if user_input in ['hello','Hello','hi','Hi','howdy','Howdy','yo','Yo']:
        "Hi. Do you want to ask me anything?"
        jump user
elif user_input in ['cow','cows','Cows','Cow','milk','Milk']:
        "That is not my cow."
        jump user
elif user_input in ['sword of power','Sword of Power']:
        "What!?!?!??!"
        jump other
label other:
    "You know of the sword of power? You must be the 'chosen one' bla bla bla..."
    "The End"
    return

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#18 Post by isobellesophia »

Paul Kinsella wrote: Tue May 19, 2020 10:05 am Is the code (written below) what you have in mind? If not, please feel free to alter it. Unfortunately (as it is now) if you put in gibberish such as "asgdfds3gh", or something like "That cow is nice" or "Hi there stranger" you jump to "You know of the sword of power? You must be the 'chosen one' bla bla bla..."
I wish I had the experience to make this code work. Thank you again for your efforts. :)

Code: Select all

define user_input=[]
label start:
    "Welcome!"
label user:
    $ user_input = renpy.input(prompt = "Type anything you want!", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!")
    $ user_input=user_input.lower().strip()
    if user_input == "": #This will happen if there's no input.
        "You didn't say anything. You must be the strong siolent type."
        jump user
if user_input in ['hello','Hello','hi','Hi','howdy','Howdy','yo','Yo']:
        "Hi. Do you want to ask me anything?"
        jump user
elif user_input in ['cow','cows','Cows','Cow','milk','Milk']:
        "That is not my cow."
        jump user
elif user_input in ['sword of power','Sword of Power']:
        "What!?!?!??!"
        jump other
label other:
    "You know of the sword of power? You must be the 'chosen one' bla bla bla..."
    "The End"
    return
As i said, you shouldn't put some story label below them except for the label named "untype", as i already given above twice. After, you can now put your labels below the "untype" label, or create a new rpy file in your file game so you can put the "other" label there, RenPy always remember that your labels are in the other rpy file. About the player aside of saying "Nice cow", i will give an example after replying to this post.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Paul Kinsella
Regular
Posts: 29
Joined: Sat May 02, 2020 9:53 am
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#19 Post by Paul Kinsella »

isobellesophia wrote: Tue May 19, 2020 10:54 am As i said, you shouldn't put some story label below them except for the label named "untype", as i already given above twice. After, you can now put your labels below the "untype" label, or create a new rpy file in your file game so you can put the "other" label there, RenPy always remember that your labels are in the other rpy file. About the player aside of saying "Nice cow", i will give an example after replying to this post.
Unfortunately I am VERY new to Ren'py. So I do not understand what you have written.
isobellesophia wrote: Tue May 19, 2020 10:54 am you shouldn't put some story label below them except for the label named "untype"
I'm not sure what you mean by the above. Is THIS code correct...

define user_input=[]
label start:
"Welcome!"
label user:
$ user_input = renpy.input(prompt = "Type anything you want!", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!")
$ user_input=user_input.lower().strip()
if user_input == "": #This will happen if there's no input.
"You didn't say anything. You must be the strong siolent type."
jump user
if user_input in ['hello','Hello','hi','Hi','howdy','Howdy','yo','Yo']:
"Hi. Do you want to ask me anything?"
jump user
elif user_input in ['cow','cows','Cows','Cow','milk','Milk']:
"That is not my cow."
jump user
elif user_input in ['sword of power','Sword of Power']:
"What!?!?!??!"
jump other
isobellesophia wrote: Tue May 19, 2020 10:54 am After, you can now put your labels below the "untype" label, or create a new rpy file in your file game so you can put the "other" label there, RenPy always remember that your labels are in the other rpy file.
I don't know what you mean by this either because I am VERY new to ren'py. Could you perhaps explain this a little more? How do I "create a new rpy file in my file game"? Thank you very much and I look forward to your post. :D

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#20 Post by isobellesophia »

My apologies, to make you understand, just copy this in your script instead, and this will lead no error, all your question asked a few days ago are also in here in my written code.

I also put the randomize answer for the player whenever you type something, just like you asked.

Code: Select all

define user_input=[] 
label start: 
"Welcome!" 

label user: $ user_input = renpy.input(prompt = "Type anything you want!", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!") 

$ user_input=user_input.lower().strip() 
if user_input == "": #This will happen if there's no input. "You didn't say anything. You must be the strong siolent type." 
jump user 

if user_input in ['hello','Hello','hi','Hi','howdy','Howdy','yo','Yo']:
$ randhello = renpy.random.randint(1, 10) 
if randhello == 1:
"Hello!"
elif randhello == 2: 
"Nice to meet you."
elif randhello == 3:
"Im your friend, hi." 
else:
"Hi. Do you want to ask me anything?" 
jump user 

elif user_input in ['cow','cows','Cows','Cow','milk','Milk']: 
$ randcow = renpy.random.randint(1, 10) 
if randcow == 1:
"That is not my cow."
elif randcow == 2: 
"Nice cow."
elif randcow == 3:
"Is that your cow?"
jump user 

elif user_input in ['sword of power','Sword of Power']: 
"What!?!?!??!" 
jump other

label untype: 
$ randdiag = renpy.random.randint(1, 10) 
show m think with dissolve 

if randdiag == 1: 
a "This is what happens when you typed anything beside from the code above."
jump user 

elif randdiag == 2: 
a "Wywisjdow is not a word!" 
jump user

########################
PUT YOUR LABELS HERE, NOT THE TOP OF THE LABEL NAMED
"UNTYPE", COPY THIS ONE FOR NO PROBLEMS
AND SUCH.####################

label other:
"Now this is your label you wanted so far."
jump user

I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Paul Kinsella
Regular
Posts: 29
Joined: Sat May 02, 2020 9:53 am
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#21 Post by Paul Kinsella »

Thank you very much for attempting to help me understand. I cut and pasted this into a new script and I got many errors. Perhaps because I don't understand what's meant by...

########################
PUT YOUR LABELS HERE, NOT THE TOP OF THE LABEL NAMED
"UNTYPE", COPY THIS ONE FOR NO PROBLEMS
AND SUCH.####################

No doubt, this is because I am very new. :(
Would you mind if I asked others for help?

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#22 Post by isobellesophia »

Sorry for another misunderstanding, that means you need to put your labels below that hashtags, like the "other" label, what errors do you encounter exactly?
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Paul Kinsella
Regular
Posts: 29
Joined: Sat May 02, 2020 9:53 am
Contact:

Re: Replying through dialogue/ Artificial Intelligence based

#23 Post by Paul Kinsella »

If you want, we can continue to here... viewtopic.php?f=8&t=59022&p=529667#p529667 :D
Apparently the "Ren'Py Cookbook" part of the form is not really intended for questions.

Post Reply

Who is online

Users browsing this forum: No registered users