Ren'Py Windows scale help

Parsion

Newbie
Jun 11, 2017
38
9
Hi Guys, I'm developping a game on ren'py.

The current resolution of the game is 1280x720 in window mode.

But in the game, When I select Full Screen Mode in Preferences, it will put the game in a window bigger than 1920x1080 ahaha how to fix this problem ?

I'm a beginner in Ren py coding so please, be as clear as possible. Just tell me how to code it please.

Or how can I code in the game the possibility to make the window in full screen, you know, the automatic enlarge button on the top right window of the game, how can I make this possible ?

Thanks you for helping me guys.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
But in the game, When I select Full Screen Mode in Preferences, it will put the game in a window bigger than 1920x1080 ahaha how to fix this problem ?
Why do you want to fix that ? It's part of Ren'py feature, it will correctly resize the screen whatever the monitor size and whatever the initial game resolution.


Or how can I code in the game the possibility to make the window in full screen, you know, the automatic enlarge button on the top right window of the game, how can I make this possible ?
[Wrote in the fly, I can have made some error but the spirit is here]
Code:
init python:
    def enlargeScreen( fullscreen ):
        if fullscreen is True:
            config.overlay_screens.append( "myReduceButton" )
            config.overlay_screens.remove( "myEnlargeButton" )
            renpy.run( Preference( "display", "fullscreen" ) )
        else:
            config.overlay_screens.append( "myEnlargeButton" )
            config.overlay_screens.remove( "myReduceButton" )
            renpy.run( Preference( "display", "window" ) )

    enlargeScreen( False )   # windowed by default

screen myEnlargeButton:
     textbutton "enlarge":
         action Function( enlargeScreen, True )

screen myReduceButton:
     textbutton "reduce":
         action Function( enlargeScreen, False )
There's easier possible way, but in the same this one teach you something about overlay screens and how use screen actions outside of a screen.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
Thanks you ! I copypaste this in the option.rpy or the script.rpy ? I think its option.
In whatever you want.

All the .rpy files will be read and parsed, and their names have no meaning at all. So where you put this or that is only a matter of personal taste. By example, the "screens.rpy" file is generally forgot by coders, who put their own screens either in "script.rpy" of in a file they created themselves. Therefore, you arrange your files and their content in the way that feel the more natural for you. What matter isn't that "this" was put in "that file", but that you'll know where to find it if you need it.
You can even put you .rpy files in a sub folder of "game", they'll be found and correctly parsed.

It's the same for things like init, label and screen blocks. You can put them wherever you want in the file. It can look like this :
Code:
init:
  [...]
label myLabel:
  [...]
init:
  [...]
label otherLabel:
  [...]
screen oneScreen:
  [...]
label yetAnotherLabel:
  [...]
init:
  [...]
It will still work correctly. The init blocks will be interpreted when Ren'py start, the screen blocks will generate the... (suspense) screens, and the label will be interpreted when you'll call them or jump to them.

If you want, think of it like a lego construction. Each init, label and screen blocks are some bricks, and the file the boxes where they are stored. Whatever if a brick is on top of the box or on the bottom, whatever if two related bricks are on the same box or not. In the end, they'll all be put at the right place and the result will look like you want (modulo your own coding skills).
 

Parsion

Newbie
Jun 11, 2017
38
9
If you want, think of it like a lego construction. Each init, label and screen blocks are some bricks, and the file the boxes where they are stored. Whatever if a brick is on top of the box or on the bottom, whatever if two related bricks are on the same box or not. In the end, they'll all be put at the right place and the result will look like you want (modulo your own coding skills).
I got this message :

Code:
I'm sorry, but an uncaught exception occurred.

While executing init code:
  File "game/script.rpy", line 18, in script
  File "game/script.rpy", line 29, in python
  File "game/script.rpy", line 25, in python
Exception: config.overlay_screens is not a known configuration variable.
What does that mean ?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
Code:
Exception: config.overlay_screens is not a known configuration variable.
What version of Ren'py do you use ? If my memory is correct, overlay_screens was introduced in 6.99.7, or near to that. I don't have a 6.99.14.1 right now to test, but I'm pretty sure that it's still valid ; while I know that it still works on 6.99.14.
So, what it mean seem to be that you use a too old version of Ren'py. Get the and try again.
 

Parsion

Newbie
Jun 11, 2017
38
9
What version of Ren'py do you use ? If my memory is correct, overlay_screens was introduced in 6.99.7, or near to that. I don't have a 6.99.14.1 right now to test, but I'm pretty sure that it's still valid ; while I know that it still works on 6.99.14.
So, what it mean seem to be that you use a too old version of Ren'py. Get the and try again.
Now I have the last version of ren'py but I got this :

Code:
While running game code:
  File "game/script.rpy", line 18, in script
    init python:
  File "game/script.rpy", line 29, in <module>
    enlargeScreen( False )   # windowed by default
  File "game/script.rpy", line 26, in enlargeScreen
    config.overlay_screens.remove( "myReduceButton" )
ValueError: list.remove(x): x not in list
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
[note: I'm wasted, sorry by advance it the tone of my answer can feel wrong or angry]
Code:
  File "game/script.rpy", line 26, in enlargeScreen
    config.overlay_screens.remove( "myReduceButton" )
ValueError: list.remove(x): x not in list
You know really nothing about coding, right ?
So, like the error say, you (well, I) tried to remove something which isn't in the list. So the solution to solve this error is to condition the removing.
Code:
    if "myReduceButton" in config.overlay_screens:
        config.overlay_screens.remove( "myReduceButton" )
Change the other line with "remove" in the same way, without forgetting to also replace "myReduceButton" by "myEnlargeButton".

There's, somewhere in this part of the forum, a topic about learning python/ren'py. You should probably take a look at it. While Ren'py is not really difficult to understand and use, it's still better to have some coding knowledge. It will not always help you to do something, but will clearly help you understand why a thing don't work.

If it still not work (which is possible since I was in hurry when I wrote it in the fly), I'll give you an alternate way to do it tomorrow.
 

Parsion

Newbie
Jun 11, 2017
38
9
Yeah, I know nothing, I learn myself since a few weeks, I know enough to build my game in script. I know how to programming choices and storytelling with images by reading tutorials, but this window scale problem is bothering me as hell, I don't want future PM of players who said to me "hey, I can't play in fullscreen"


Code (Text):

if "myReduceButton" in config.overlay_screens:
config.overlay_screens.remove( "myReduceButton" )

Change the other line with "remove" in the same way, without forgetting to also replace "myReduceButton" by "myEnlargeButton".
"Change the other line" wait, which line ? I don't undestant chat you mean... Yeah, you must think I'm a jerk but it's not very clear for me... I'm so sorry.

I'm planning to hire a professionnal programmer in a far/close future, to made something more ambitious but now I just would like to correct the fullscreen problem. This is the only problem I can't solve by myself, the other I corrected them by learning with videos and tutorials.

Because for me, building a visual novel is a way to practice art. I used to draw comics but I want to change my way of tellling stories. Now, I'm building a game like a GAMEBOOK, in which dialogues and choices are the center of the gameplay.

Here a screenshot of what I'm looking on my computer screen, maybe it will be easier for you to show me how to correct this :
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
"Change the other line" wait, which line ?
The initial code is this :
Code:
    def enlargeScreen( fullscreen ):
        if fullscreen is True:
            config.overlay_screens.append( "myReduceButton" )
            config.overlay_screens.remove( "myEnlargeButton" )
            renpy.run( Preference( "display", "fullscreen" ) )
        else:
            config.overlay_screens.append( "myEnlargeButton" )
            config.overlay_screens.remove( "myReduceButton" )
            renpy.run( Preference( "display", "window" ) )
Then I changed one of the two lines implying "remove" to this :
Code:
  if "myReduceButton" in config.overlay_screens:
        config.overlay_screens.remove( "myReduceButton" )
So obviously the other line to change is the other line implying "remove"
Code:
  if "myEnlargeButton" in config.overlay_screens:
        config.overlay_screens.remove( "myEnlargeButton" )
This said, I said that if you still had problem I'll give you a easier solution, so here it is :
Code:
init python:
    config.overlay_screens.append( "enlargeReduceButton" )

screen enlargeReduceButton:
     if preferences.fullscreen is False:
          textbutton "enlarge":
               action Preference( "display", "fullscreen" )
     else:
          textbutton "reduce":
               action Preference( "display", "window" )