Menu error

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
7mer4
Newbie
Posts: 2
Joined: Fri Jan 25, 2019 2:42 am
Contact:

Menu error

#1 Post by 7mer4 »

Hello everyone, who can help? Image Image Image

User avatar
MrTorex
Newbie
Posts: 7
Joined: Fri Jan 25, 2019 3:00 am
Projects: Secret Idea
Location: Belarus
Contact:

Re: Menu error

#2 Post by MrTorex »

Can you show the part of the code where the scope is? Because i don't see it in your code.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Menu error

#3 Post by Imperf3kt »

Your indentation is also incorrect. Ren'Py uses four spaces, but you have supplied what looks like two.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Menu error

#4 Post by IrinaLazareva »

Imperf3kt wrote: Fri Jan 25, 2019 6:20 amRen'Py uses four spaces
The number of spaces can be anything (4, 5, 10... or 1). The main thing is to follow the Indentation's rules.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Menu error

#5 Post by Imperf3kt »

IrinaLazareva wrote: Sat Jan 26, 2019 10:12 am
Imperf3kt wrote: Fri Jan 25, 2019 6:20 amRen'Py uses four spaces
The number of spaces can be anything (4, 5, 10... or 1). The main thing is to follow the Indentation's rules.
Which is set out in the beginning.
Take a look at the files found in renpy/common - they all use 4 spaces and make up the base upon which projects created with the launcher are built upon. So using anything other than four spaces means you are not following indentation previously set out.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Menu error

#6 Post by IrinaLazareva »

Imperf3kt wrote: Sat Jan 26, 2019 12:42 pm So using anything other than four spaces means you are not following indentation previously set out.
...then this code should cause an indentation error:

Code: Select all

label start:
    menu:
        'one':
            pass
        'two':
            pass
    menu:
      'three':
        pass
      'four':
        pass
    return
However, it doesn't happen... The indentation should be done inside the blocks, and separate the blocks. But what happens between the blocks does not matter.

Actually, bypassing "the four-spaces canon" greatly simplifies the code editing.
Here a good example.
Image
https://pp.userapi.com/c851216/v8512165 ... tEFf4Q.jpg
If I need to change the code (picture on the left) on the seventh line, for example, to add a If-condition, I will have to move all the lines starting from the eighth and below.
But, if I don't execute "the four-spaces canon", it is enough to change only two lines (line 7, 8, picture on the right).

P.S. I don't insist on being right. I just show you the possibilities of language. (RenPy is based on python. And python was designed to make the programmer's job easier.:))

Post Reply

Who is online

Users browsing this forum: No registered users