resolution

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
muffin
Newbie
Posts: 7
Joined: Tue Sep 30, 2008 4:27 am
Contact:

resolution

#1 Post by muffin »

hello everybody this is my first post here. I'd have to say I'm quite surprised the ease of use Ren'Py, being a non-programmer myself. I went through the online quick start and documentation, and found it to be very clear and helpful. As an artist I like to work @ 1024x768 resolution for my work, problem being I'm not quite sure how to achieve this is my script.

init:
config.screen_height = 1024
config.screen_width = 768

label start:

On line 1 of D:\programs\renpy-6.7.1\theGoddess/game/script.rpy: init statement expects a non-empty block.
init:
^

On line 2 of D:\programs\renpy-6.7.1\theGoddess/game/script.rpy: expected statement.
config.screen_height = 1024
^

On line 3 of D:\programs\renpy-6.7.1\theGoddess/game/script.rpy: expected statement.
config.screen_width = 768
^



this is what I have at start of my script, but doesn't work, I'm not sure If have to use a different script in the directory. If anyone can point out my mistake, I'd be most grateful.
thank you

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: resolution

#2 Post by PyTom »

Your best bet is to edit the image sizes into options.rpy.

The proximate cause of your problem is that your code isn't indented correctly, and that you need to either proceed each python statement with a $ or use an init python block. But options.rpy has a nice init python block set up, so you should use that.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Formedras
Regular
Posts: 40
Joined: Sat Oct 04, 2008 3:11 am
Projects: Ninja TK
Contact:

Re: resolution

#3 Post by Formedras »

Actually, I think the reason that it doesn't work is that the config variables can't be accessed from Ren'Py code; only Python blocks. I'm not sure, and I know I'm contradicting the expert about one of the causes, even though I'm not contradicting the answer. (In other words, the correct solution, regardless of the technicalities involved, IS to edit options.rpy's config.screen_height and config.screen_width declarations, just like the master says.) And yes, I do understand that the indentation screws things up as well.

The reason I don't think that config variables are accessible from Ren'Py blocks is that I tried to access config.developer from the "start" block and it gave me an error. (I asked for config.developer's value so as to make the difference between the developer's menu and what the regular player gets.) I may have just done this wrong, though.

In other words, the proper way to change those variables outside of the options.rpy file would be to make an "init python" block and make a routine that changes those. Not that that does any good if it occurs after the window is generated, since the window size doesn't change along with it.
http://www.google.com/profiles/tizalka
Current Project:
Ninja TK

Twar3Draconis
Regular
Posts: 129
Joined: Thu Apr 19, 2007 12:07 am
Location: Michigan, United States, Terra
Contact:

Re: resolution

#4 Post by Twar3Draconis »

The debug messages make it sound as if you don't have correct indents.
Image

herenvardo
Veteran
Posts: 359
Joined: Sat Feb 25, 2006 11:09 am
Location: Sant Cugat del Vallès (Barcelona, Spain)
Contact:

Re: resolution

#5 Post by herenvardo »

Formedras wrote:Actually, I think the reason that it doesn't work is that the config variables can't be accessed from Ren'Py code; only Python blocks.
To be more exact, Ren'py has no explicit syntax to manipulate variables, so you have to use Python's syntax, and hence tell Ren'py that these statements are actually in Python's syntax rather than Ren'py's. Either putting the code within a python (or init python) block, or preceeding the statement with a "$" (which is like making a single-line python block). This applies to variables in general, not just config variables.
Formedras wrote:The reason I don't think that config variables are accessible from Ren'Py blocks is that I tried to access config.developer from the "start" block and it gave me an error.
That's actually a separate point: config variables need to be set up during the init stage, before the game actually begins. This is because Ren'py needs to already know the value of some (probably most) of them during starting up, before the main menu screen is even shown (for example, it needs to know at which resolution the game should be displayed before the main menu screen can be shown at that resolution). Trying to change these variables after the init phase will, in most cases, have nasty side-effects. Even in the case you could manage to properly adjust one of these variables during the game, you'd still face the issue that they don't participate on save/load.
So, you need to set these variables on init (or init python) blocks. Setting them from a non-python init block is OK (as long as you prefix them with "$"), but doing so from a python block that is not part of the init stage wouldn't work.
Formedras wrote:In other words, the proper way to change those variables outside of the options.rpy file would be to make an "init python" block and make a routine that changes those. Not that that does any good if it occurs after the window is generated, since the window size doesn't change along with it.
That wouldn't achieve anything useful: as you mention, the window size wouldn't be updated (I think there are ways to resize it, but that'd be non-trivial). But, in addition, the change wouldn't persist upon a save and reload.
There might be workarounds for many of the variables, but they are complex in the best case, and a hell of cryptic code mess in the worst.
Twar3Draconis wrote:The debug messages make it sound as if you don't have correct indents.
This is exactly one of the causes of the problem; and PyTom already mentioned it.

I'll try to explain as simply as I can to make it easier for muffin to understand ;):
First, and the most critical fact: both python and ren'py rely on indentation (ammount of whitespace preceeding a line) to figure out which lines are inside of each block: for example, after a init: statement, everything below it that has a deeper indentation is considered the content of that block, until a line is found that has the same or less indentation than the "init:" opener. This applies to all other kinds of blocks as well. Looking at your code:

Code: Select all

init:
config.screen_height = 1024
you can see that the second line has the same indentation (0 spaces) as the first one, so it's not part of the "init:" block. Since there is actually nothing really inside the block, ren'py complains with the message "init statement expects a non-empty block": it's just complaining because it wants a non-empty block, and you gave it an empty block. If you changed your code to something like this:

Code: Select all

init:
    config.screen_height = 1024
    config.screen_width = 768
The statements are now part of the init block, as they should be, so the first error message would disappear. For the other messages, the issue is that these statements are python statement, but the engine is trying to process them as ren'py statements: you need to tell the engine that they are actually python to solve this. Either of these snippets would work:

Code: Select all

init python: # this tells the engine that the statements inside this init block are all python
    config.screen_height = 1024
    config.screen_width = 768

Code: Select all

init:
    # The '$' symbol is used to introduce a single-line python statement:
    $ config.screen_height = 1024
    $ config.screen_width = 768
Finally, I'll mention on PyTom's comment about puting this stuff on options.rpy: the first thing to point out is that this file is expresselly intended for this; so it's by default the most reasonable place. Next, it is already structured to hold a lot of config variable assignments inside an init python block; and it is very well commented so you can know what each line is supposed to do. And last, but not least, having statements that do incompatible things at different places of the code is confusing, and in some cases may be error-prone, so you'd better avoid it: you have a couple of lines in options.rpy that set the screen resolution to the 800x600 default; and then you have another couple lines somewhere else which set the resolution at 1024x768: which resolution would actually apply? (Actually, in this case it would work properly and display the window at 1024x768, but you can see how this is confusing anyway). It makes more sense to replace the values where the resolution is set, rather than to set it at different values from different parts of the code.

HTH
I have failed to meet my deadlines so many times I'm not announcing my projects anymore. Whatever I'm working on, it'll be released when it is ready :P

muffin
Newbie
Posts: 7
Joined: Tue Sep 30, 2008 4:27 am
Contact:

Re: resolution

#6 Post by muffin »

thank you everyone for the quick reply, and making it simple for a non-programmer to understand. :D
I'm going to try and set this up when I get home.
thanks again everyone!

Killa92
Newbie
Posts: 1
Joined: Tue Sep 24, 2013 2:04 am
Contact:

Re: Hello. Hope anyone could help me with my problem.

#7 Post by Killa92 »

Hello everyone. Well right now I am in process making my 1st Renpy game. I already success to put my character in the game. Then I decided to put some options to choose for my game. I follow instruction given by some blog I visit when I google for the tutorial. When I try to launch my game suddenly the errors above occurs. So I need help from anyone who know how I could solve my problems.
Here is the problems I have :

http://i669.photobucket.com/albums/vv54 ... cats-2.jpg.

Hope anyone could help me out. I'd really appreciate it. Well I am newbie to this Renpy stuff so I need lots of help :)

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: resolution

#8 Post by Elmiwisa »

Killa92 wrote:Hello everyone. Well right now I am in process making my 1st Renpy game. I already success to put my character in the game. Then I decided to put some options to choose for my game. I follow instruction given by some blog I visit when I google for the tutorial. When I try to launch my game suddenly the errors above occurs. So I need help from anyone who know how I could solve my problems.
Here is the problems I have :

http://i669.photobucket.com/albums/vv54 ... cats-2.jpg.

Hope anyone could help me out. I'd really appreciate it. Well I am newbie to this Renpy stuff so I need lots of help :)
Rule of thumb - if a line end with :
then the next line need to be indented more by at least 1 space (more than 1 is fine, Tab=4 spaces); but without the : you cannot indent extra; the details can be found here

Post Reply

Who is online

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