Need help for a minute

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
isobellesophia
Miko-Class Veteran
Posts: 694
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Need help for a minute

#1 Post by isobellesophia » Sat Aug 10, 2019 8:41 am

Hello,

i need a help for this, it seems not to be working ad got a error if the user types 4 different words below..

Code: Select all

if user_input == (['hello','Hello','hello!','Hello!]):
        
        m "Hello!"
Last edited by isobellesophia on Sun Aug 11, 2019 5:40 am, edited 2 times in total.
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

User avatar
arty
Regular
Posts: 104
Joined: Sat Jan 06, 2018 11:55 am
Completed: White Monday
Projects: HATE is a 4 Letter Word
Organization: KATHARSIS ART
itch: artys-games
Contact:

Re: Need help for a minute

#2 Post by arty » Sat Aug 10, 2019 9:02 am

What error are you getting?

User avatar
isobellesophia
Miko-Class Veteran
Posts: 694
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Need help for a minute

#3 Post by isobellesophia » Sat Aug 10, 2019 9:09 am

arty wrote:
Sat Aug 10, 2019 9:02 am
What error are you getting?

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 61: is not terminated with a newline. (Check strings and parenthesis.)
(Perhaps you left out a ' at the end of the first line.)
        if user_input == (['hello','Hello','hello!','Hello!]):

Ren'Py Version: Ren'Py 7.3.2.320
Sat Aug 10 20:39:24 2019
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

drKlauz
Regular
Posts: 166
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Need help for a minute

#4 Post by drKlauz » Sat Aug 10, 2019 9:47 am

Code: Select all

## remove leading/trailing spaces, turn AbCdEf intro abcdef
$user_input=user_input.lower().strip()
## check known words
if user_input in ['hello!','hi!','hello','hi']:
  m 'Hello!'
You may get better results if you use/write actual parser for such things.

User avatar
ComputerArt.Club
Veteran
Posts: 409
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Need help for a minute

#5 Post by ComputerArt.Club » Sat Aug 10, 2019 9:49 am

Try changing:

Code: Select all

if user_input == (['hello','Hello','hello!','Hello!]):
to

Code: Select all

if user_input == (['hello','Hello','hello!','Hello!']):
You are missing a ' at the end of the last entry.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 694
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Need help for a minute

#6 Post by isobellesophia » Sat Aug 10, 2019 10:15 am

ComputerArt.Club wrote:
Sat Aug 10, 2019 9:49 am
Try changing:

Code: Select all

if user_input == (['hello','Hello','hello!','Hello!]):
to

Code: Select all

if user_input == (['hello','Hello','hello!','Hello!']):
You are missing a ' at the end of the last entry.
Oooohhh i see, i was oversighted it, lol thanks!!
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

User avatar
isobellesophia
Miko-Class Veteran
Posts: 694
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Need help for a minute

#7 Post by isobellesophia » Sat Aug 10, 2019 10:17 am

drKlauz wrote:
Sat Aug 10, 2019 9:47 am

Code: Select all

## remove leading/trailing spaces, turn AbCdEf intro abcdef
$user_input=user_input.lower().strip()
## check known words
if user_input in ['hello!','hi!','hello','hi']:
  m 'Hello!'
You may get better results if you use/write actual parser for such things.

Thanks also this one also worked! :)
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

User avatar
isobellesophia
Miko-Class Veteran
Posts: 694
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Need help for a minute

#8 Post by isobellesophia » Sun Aug 11, 2019 2:24 am

drKlauz wrote:
Sat Aug 10, 2019 9:47 am

Code: Select all

## remove leading/trailing spaces, turn AbCdEf intro abcdef
$user_input=user_input.lower().strip()
## check known words
if user_input in ['hello!','hi!','hello','hi']:
  m 'Hello!'
You may get better results if you use/write actual parser for such things.
ComputerArt.Club wrote:
Sat Aug 10, 2019 9:49 am
Try changing:

Code: Select all

if user_input == (['hello','Hello','hello!','Hello!]):
to

Code: Select all

if user_input == (['hello','Hello','hello!','Hello!']):
You are missing a ' at the end of the last entry.

Okay, i know this works, and get no error, but everytime i type 4 kinds of words as i wrote above, it wont show the

Code: Select all

m "Hello!"
when i type those.. every single one. Instead it will ignore it and then continue.. sorry for my bad english, is there any way to fix this? :(

i also used this to type different types of words and letters to reply the character.

Code: Select all

$ user_input = renpy.input(prompt = "Type anything! Or if you want to go places, like for example, 'Lets go to music room.'. (SCHOOL PLACES ONLY!)", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!")
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

drKlauz
Regular
Posts: 166
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Need help for a minute (NOT SOLVED YET)

#9 Post by drKlauz » Sun Aug 11, 2019 5:33 am

This works for me. Type 'HEllO', bot should greet you.

Code: Select all

label start:
  $user_input = renpy.input(prompt = "Type anything! Or if you want to go places, like for example, 'Lets go to music room.'. (SCHOOL PLACES ONLY!)", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!")
  $user_input=user_input.lower().strip()
  if user_input in ['hello','hello!','hi','hi!']:
    'Bot' 'Greetings, Master.'
  'Bot' 'What would you like today?'
  return
Tho again this approach is very limited and buggy, this is why parser-based and general text input games pretty much died out decades ago.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 694
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

Re: Need help for a minute (NOT SOLVED YET)

#10 Post by isobellesophia » Sun Aug 11, 2019 5:38 am

drKlauz wrote:
Sun Aug 11, 2019 5:33 am
This works for me. Type 'HEllO', bot should greet you.

Code: Select all

label start:
  $user_input = renpy.input(prompt = "Type anything! Or if you want to go places, like for example, 'Lets go to music room.'. (SCHOOL PLACES ONLY!)", allow="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ /.,'?!")
  $user_input=user_input.lower().strip()
  if user_input in ['hello','hello!','hi','hi!']:
    'Bot' 'Greetings, Master.'
  'Bot' 'What would you like today?'
  return
Tho again this approach is very limited and buggy, this is why parser-based and general text input games pretty much died out decades ago.

Thank you for the reply! I will try this if i had a chance. (oops, need to fix that indention line.) :D
I just need to reply once more if i had a another problem.
I am a friendly user, please respect and have a good day..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

User avatar
trooper6
Lemma-Class Veteran
Posts: 3617
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help for a minute

#11 Post by trooper6 » Sun Aug 11, 2019 12:03 pm

If you want to build an interactive fiction game like back in the 80s, you might want to look into using one of the languages built specifically for that. It might be easier for you because they should have a parser already built in.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]