"expected statement" Error with no indication

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
margaretcatter
Regular
Posts: 44
Joined: Fri May 18, 2018 7:16 pm
Projects: Kathelm Princess X Princess | Hurricane Like Me
itch: margaretcatter
Location: New York/LA
Contact:

"expected statement" Error with no indication

#1 Post by margaretcatter »

Code: Select all

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


File "game/Character Creation.rpy", line 28: expected statement.
    "[character_g1]" is Lady
                            ^

File "game/Character Creation.rpy", line 32: expected statement.
    elif Boy:
            ^

File "game/Character Creation.rpy", line 37: expected statement.
    elif gender:
               ^

Ren'Py Version: Ren'Py 6.99.14.3.3347
Sun May 20 18:01:29 2018

Code: Select all

menu:

    "Are you a girl or boy?"

    "Girl":
        $ gender_points += 2
        $Girl = True
        if Girl:
            "[character_g1]" is Lady
    "Boy":
        $ gender_points += 1
        $Boy = True
        elif Boy:
            "[character_g1]" is Sir
    "Both":
        $ gender_points += 3
        $gender = True
        elif gender:
            $ character_g1 = renpy.input("What are your prefered pronouns?")
            $ character_g1 = character_gender2.strip()
            if "He" or "Him":
                [character_gender1] is "Sir"
            elif "She" or "Her":
                [character_g1] is "Lady"
            elif "They" or "Them":
                    [character_g1] is "Master"
I've tried moving the spacing and moving the : I have something similar coded later for age range (shown below) that works so I'm not sure why this one isn't working

Code: Select all


if uage:
    g1 "Little young to be out on your own ain't you?" #SKIP EVENTS NOT YET LISTED AS THEY ARE NOT OLD ENOUGH
elif Boy or Girl or Both and Teenager:
    g1 "Where are your parents?" #Boy/Girl/Both Teenager
elif Boy or Girl or Both and YoungAdult:
    g1 "Yes you. Are you new to town, I've never seen you before." #Boy/Girl/Both Young Adult
elif Girl and Adult:
    g1 "Yes you ma'm" #Girl Adult
elif Boy and Adult:
    g1 "Yes you sir." #Boy Adult
elif Both and Adult:
    g1 "Yes you right there, are you new to Kathelm?" #Both Adult

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: "expected statement" Error with no indication

#2 Post by kivik »

Ok, once again you seem to be making up code here (like the max thing before):

Code: Select all

"[character_g1]" is Lady
I think I know what you're trying to do, but that's not valid Renpy nor python code at all. Can you explain where you came up with that code from?

You need to understand that programming language can only understand what you want it to do if you follow the specific syntax that it understands, anything else and it'll throw an error. Sometimes the error are confusing because it doesn't understand what's going on and makes the best estimate of what the error may be - like in this case.

Compare that statement to something you've got yourself:

Code: Select all

$ character_g1 = renpy.input("What are your prefered pronouns?")

vs

"[character_g1]" is Lady
Do you notice the difference between the two lines? Do you understand what the first line is doing when compared to the second?

User avatar
margaretcatter
Regular
Posts: 44
Joined: Fri May 18, 2018 7:16 pm
Projects: Kathelm Princess X Princess | Hurricane Like Me
itch: margaretcatter
Location: New York/LA
Contact:

Re: "expected statement" Error with no indication

#3 Post by margaretcatter »

I was working from this https://lemmasoft.renai.us/forums/view ... er#p486657 I had previously defined character_g1 elsewhere in my code which since it didnt give me an error I didn't include in my post. Again working from what was posted in the above link and have it work like if you had the player input a name

Code: Select all


define character_g1 = {"he" or "she" or "they"}
define character_g2 = {"Sir" or "Lady" or "Master"}

Like I knew there would be the weird grammatically thing that would happen but that was a after this error message problem.

I understand that the second is whatever the player puts in the strip() is what shows up in the place of character_g1 and I thought that if they put XYZ they'd that if I made it an "If" statement.

PS: The max point bit of code from my previous post came from this wiki page https://www.renpy.org/wiki/renpy/doc/co ... ed_Endings

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: "expected statement" Error with no indication

#4 Post by kivik »

I could be wrong but I'm getting the impression that you're reading other tutorials, half understood them, and then you're just writing your own code without carefully following each line what's happening. For example:

Code: Select all

define character_g1 = {"he" or "she" or "they"}
This line of code doesn't exist anywhere from the link, so I just want to figure out what prompted you to write that line of code - and reinforce that: you can't make up your own code.

I can see that you'll be using variables a lot in your game, and if you don't understand their nature, you're not going to get very far unfortunately, so it's really important we get you to understand the fundamental basics, before jumping to coding what you want.

This is the renpy document for how to declare variables and how to use them, please read it, and more importantly, try it out. Create a new project and test out the codes that you're not familiar with, until it does exactly what you expect them to do: https://renpy.org/wiki/renpy/doc/tutori ... er_Choices

Going back to my last post:

Code: Select all

$ variable_name = stuff
[/cod]
This is how you assign information to a variable in Renpy. There isn't a [b]is[/b] in that line, the operator = (single equal sign) is what assigns information on the right of the equal sign to what's on the left of the equal sign.

[code]
"[variable_name]"
This is how you display a variable as a narration in Renpy. It's purely designed for output purposes, and is not used to assign values to anything. In other words it doesn't take input.

I don't know how you arrived at that line, when your previous lines had correctly assigned values using the = operator, so it can only mean that you don't fully understand what your code does.


Your condition statements are also wrong, because you don't actually tell Renpy what variable you want to check for - you can see how to do it properly in the Remembering User Choices link above.



Regarding the max point bit of your code - again, nowhere in the article you linked did it have your code:

Code: Select all

$ day = 0:
    max = 7
$ tod = 0:
    max = 4
This isn't anywhere in the article - so you've basically just made it up.


So just one last reiteration: you need to follow the exact syntax expected of a programming language, if you make up your own way of telling your program to do something, chances are good that it won't work.

Post Reply

Who is online

Users browsing this forum: No registered users