Page 1 of 1

Menu error

Posted: Fri Jan 25, 2019 2:51 am
by 7mer4
Hello everyone, who can help? Image Image Image

Re: Menu error

Posted: Fri Jan 25, 2019 5:07 am
by MrTorex
Can you show the part of the code where the scope is? Because i don't see it in your code.

Re: Menu error

Posted: Fri Jan 25, 2019 6:20 am
by Imperf3kt
Your indentation is also incorrect. Ren'Py uses four spaces, but you have supplied what looks like two.

Re: Menu error

Posted: Sat Jan 26, 2019 10:12 am
by IrinaLazareva
Imperf3kt wrote:
Fri Jan 25, 2019 6:20 am
Ren'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.

Re: Menu error

Posted: Sat Jan 26, 2019 12:42 pm
by Imperf3kt
IrinaLazareva wrote:
Sat Jan 26, 2019 10:12 am
Imperf3kt wrote:
Fri Jan 25, 2019 6:20 am
Ren'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.

Re: Menu error

Posted: Sat Jan 26, 2019 3:39 pm
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.:))