[Solved] Hiding A Choice After Dealing It (?)

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
tamacitas
Regular
Posts: 73
Joined: Tue Jun 30, 2015 12:09 am
Contact:

[Solved] Hiding A Choice After Dealing It (?)

#1 Post by tamacitas »

Well, hello everyone! This is my first post at LSF :)
My first post but surely not my first visit. I'm a goddamn stalker, maybe.
So, I'm actually collaborate with my friend to make a BL game (which I won't post here because... You know.) Aaaand, I'm scripting. Damn, scripting is so much fun that I got errors over the last parts of the script.

Traceback:

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 516: Line is indented, but the preceding say menuitem statement does not expect a block. Please check this line's indentation.
    if (scifair == False):
    ^

Ren'Py Version: Ren'Py 6.99.4.467
And the script:

Code: Select all

menu:
    ja "What should I do now...?"
        if (scifair == False):
            "Check some of the science fair prototype element.":
            call science_fair
        if (booktrigger == False):
            "Ask Andrew about his book.":
            call asking_book
        if (cook == False):
            "Cook something.":
            call cooking
        if (offer == False):
            "Offer Andrew something.":
            call offer_book
        if (go_out == False):
            "Go out.":
            call going
        "Wait for the car.":
        jump car
        
    label science_fair:
        $ love += 1
        ja "I shouldn't touch the prototype. I don't want to ruin it."
        $ scifair = True
        return
        
    label asking_book:
        if ask == 3:
            a "What, asking me again of the book?"
            a "Why don't you do something else than asking me that?"
            $ booktrigger = True
        else:
            $ ask += 1
            j "Andrew..."
            a "What?"
            if ask == 1:
            j "I wonder if our project has a connection with books you have."
            a "..."
            if ask == 2:
                j "You won't mind if I read your book, right?"
                a "..."
        return
                
    label cooking:
        menu:
        ja "Maybe I can cook something..."
        if (omelet == False):
            "Omelet.":
                call omelet1
        if (toast == False):
           "Toast.":
                call toast1
        "Nothing.":
            jump not0
            
        label omelet1:
            j "Would you like a plate of omelet, Andrew?"
            a "..."
            ja "Maybe I'll just make one for him."
            
            j "Here you go."
            a "What?"
            j "Omelet. I hope you like it."
            a "...Thanks."
            $ love += 1
            $ omelet = True
            return
            
        label toast1:
            j "Would you like some toast, Andrew?"
            a "*nods*"
            
            j "Here you go."
            a "Thank you."
            $ love += 1
            $ toast = True
            return
            
        label not0:
            j "It's also late... Maybe not."
            $ cook = True
            return
            
    label offer_book:
        a "..."
        ja "He seems to be stressed..."
        j "Andrew..."
        a "..."
        j "W-Would you like me to take another book for you?"
        a "...{nw}"
        a " Sure."
        j "What kind of book would you like?"
        a "Whatever it is."
        
        j "Here you go."
        a "Thanks."
        $ love += 1
        $ offer = True
        return
        
    label going:
        ja "I shouldn't go out. It's raining."
        $ go_out = True
        return
    
    label car:
    # Something I haven't put yet.
First I used the statement 'if not scifair:', but it expected a menuitem. Again, when I use the statement '"if(scifair == False)", it still keeps error.
Or should I use if(scifair=False?)
I only found a thread regarding of this at LSF (the second statement) but it still won't work.

Sorry, I'm a noob TnT Help please?
Last edited by tamacitas on Tue Jul 07, 2015 3:37 am, edited 1 time in total.

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Hiding A Choice When You Already Deal With It - Also hel

#2 Post by Zetsubou »

You're writing the menu if statements incorrectly.
eg.

Code: Select all

menu:
    ja "What should I do now...?"
        if (scifair == False):
            "Check some of the science fair prototype element.":
            call science_fair
        if (booktrigger == False):
            "Ask Andrew about his book.":
            call asking_book
            #...
Should be like:

Code: Select all

menu:
    ja "What should I do now...?"
    
    "Check some of the science fair prototype element." if scifair == False:
        call science_fair
    "Ask Andrew about his book." if booktrigger == False:
        call asking_book
        #...
Also, later in your code you have some real indenting issues.
eg.

Code: Select all

    label cooking:
        menu:
        ja "Maybe I can cook something..."
should be

Code: Select all

    label cooking:
        menu:
            ja "Maybe I can cook something..."
And I don't think you can nest labels.

Remember, indenting is very important in python.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

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

Re: Hiding A Choice When You Already Deal With It - Also hel

#3 Post by trooper6 »

Yeah, I second Zetsubuo...your indentation is all over the place...and there are some scripting choices you made that won't do what you want them to do. I have rewritten your code so that it works the way you seem to want it to.

Code: Select all

# Declare characters used by this game.
define j = Character('Jam', color="#ffffff")
define a = Character('Andrew', color="#ffffff")

#(1) Make sure you declare your varaibles
default scifair = False
default booktrigger = False
default cook = False
default offer = False
default go_out = False
default love = 0
default ask = 0
default omelet = False
default toast = False

#The game starts here. 
label start:
    # (2) Menu choices, including menu choices with if is detailed here: http://www.renpy.org/doc/html/menus.html
    menu choices:
        j "What should I do now...?"
        "Check some of the science fair prototype element." if not scifair: 
            # (3) the things that are after a colon must be indented because it is a block
            jump science_fair 
        "Ask Andrew about his book." if not booktrigger:
            jump asking_book
        "Cook something." if not cook:
            jump cooking
        "Offer Andrew something." if not offer:
            jump offer_book
        "Go out." if not go_out:
            jump going
        "Wait for the car.":
            jump car

    #I'm going to assume that you wanted to jump back to your menu over and over...if you want to do that, you should
    #give your menu a name and then jump back to it. Your calls would result in coming back after the menu and not repeating it.
      
label science_fair:
    $ love += 1
    j "I shouldn't touch the prototype. I don't want to ruin it."
    $ scifair = True
    jump choices
    
label asking_book:
    if ask == 3:
        a "What, asking me again of the book?"
        a "Why don't you do something else than asking me that?"
        $ booktrigger = True
    else:
        $ ask += 1
        j "Andrew..."
        a "What?"
        if ask == 1: #You need to indent new blocks
            j "I wonder if our project has a connection with books you have."
            a "..."
        if ask == 2:
            j "You won't mind if I read your book, right?"
            a "..."
    jump choices
        
label cooking:
    menu:
        j "Maybe I can cook something..."
        "Omelet." if not omelet:
            j "Would you like a plate of omelet, Andrew?"
            a "..."
            j "Maybe I'll just make one for him."
            j "Here you go."
            a "What?"
            j "Omelet. I hope you like it."
            a "...Thanks."
            $ love += 1
            $ omelet = True            
        "Toast." if not toast:
            j "Would you like some toast, Andrew?"
            a "*nods*"
            j "Here you go."
            a "Thank you."
            $ love += 1
            $ toast = True
        "Nothing.":
            j "It's also late... Maybe not."
            $ cook = True
    jump choices            
    
label offer_book:
    a "..."
    j "He seems to be stressed..."
    j "Andrew..."
    a "..."
    j "W-Would you like me to take another book for you?"
    a "...{nw}"
    a " Sure."
    j "What kind of book would you like?"
    a "Whatever it is."
    j "Here you go."
    a "Thanks."
    $ love += 1
    $ offer = True
    jump choices
    
label going:
    j "I shouldn't go out. It's raining."
    $ go_out = True
    jump choices

label car:
    "Your story continues on from here. You aren't going to jump back to choices..."
# Something I haven't put yet.
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

User avatar
tamacitas
Regular
Posts: 73
Joined: Tue Jun 30, 2015 12:09 am
Contact:

Re: Hiding A Choice When You Already Deal With It - Also hel

#4 Post by tamacitas »

Well, I'm still a newbie in scripting, so...
Anyways, thank you for the replies! Some time ago I've solved it but then got error again (?)
So again, many many thanks!

I guess this is solved then.

Post Reply

Who is online

Users browsing this forum: No registered users