Renpy error: "Screen is not known" in Android

Doorknob22

Super Moderator
Moderator
Game Developer
Nov 3, 2017
2,226
5,362
I released my game and some (Android) players complain that the game crashes with the following error:

I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/000statements.rpy", line 533, in execute_show_screen

Exception: Screen world_map is not known.

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "map.rpyc", line 200, in script
File "renpy/ast.py", line 1960, in execute
File "renpy/ast.py", line 1948, in call
File "renpy/statements.py", line 278, in call
File "renpy/common/000statements.rpy", line 533, in execute_show_screen
File "renpy/display/screen.py", line 1115, in show_screen
Exception: Screen world_map is not known.


1. Obviously this screen (world_map) exist in the code, written exactly like they are written in the error message.
2. I played the game extensively on my Android, Android emulation and windows and never got these errors.

Any idea where I should start looking for the problem?
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
You have two screens for world_map...

Python:
screen world_map:
    variant "large"
    imagebutton auto "Maps/map_%s.png" at center action NullAction()
    # more blah, blah...

screen world_map:
    variant "small"
    imagebutton auto "Maps/map_%s.png" at center action NullAction()
    # more blah, blah...

Best guess... You have players playing on an Android device flagged as "medium" screen size.

I haven't ever played around with screen variants. But I'm going to guess the answer is to remove the variant "large" from the first screen. Without a variant line I assume it will then act as the default screen, except when a small screen is detected. At least, that's how I hope it works.
 

Doorknob22

Super Moderator
Moderator
Game Developer
Nov 3, 2017
2,226
5,362
You have two screens for world_map...

Python:
screen world_map:
    variant "large"
    imagebutton auto "Maps/map_%s.png" at center action NullAction()
    # more blah, blah...

screen world_map:
    variant "small"
    imagebutton auto "Maps/map_%s.png" at center action NullAction()
    # more blah, blah...

Best guess... You have players playing on an Android device flagged as "medium" screen size.

I haven't ever played around with screen variants. But I'm going to guess the answer is to remove the variant "large" from the first screen. Without a variant line I assume it will then act as the default screen, except when a small screen is detected. At least, that's how I hope it works.
That's awesome, thanks! One more favor, if I may: while you're poking around my code, any idea why I can't get a decent sized font on Android? I set gui.text_size = 54 for crying out loud and it's still ant sized.

giphy.gif
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,490
7,035
That's awesome, thanks! One more favor, if I may: while you're poking around my code, any idea why I can't get a decent sized font on Android? I set gui.text_size = 54 for crying out loud and it's still ant sized.
Are you using a custom font? Or letting Ren'py do its thing with its default font?
 

Doorknob22

Super Moderator
Moderator
Game Developer
Nov 3, 2017
2,226
5,362
Care to share, in case anybody else runs into the same thing?
I attempted to create a button in the preferences page that will allow the player to increase or decrease the font size. I wasn't successful but I did leave a gui.text_size = 22 in which overrode all the settings I was playing with under ## Mobile devices

So I find this line and I look at it suspiciously, asking "what are you doing here?" and I see it doesn't look me in the eye, shifting from side to side, looking guilty as hell.

"You're not from around here, are you?" I ask. The line just shrugs, probably hoping that I'll just go away.

Deleted it, problem solved.
 
Last edited:
  • Like
Reactions: Rich

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,490
7,035
So I find this line and I look at it suspiciously, asking "what are you doing here?" and I see it doesn't look me in the eye, shifting from side to side, looking guilty as hell.

"You're not from around here, are you?" I ask and the line just shrugs, probably hoping that I'll just go away.
LOL. Been there, done that, although with less humor. Thanks for the smile!
 
  • Like
Reactions: Doorknob22

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
I attempted to create a button in the preferences page that will allow the player to increase or decrease the font size. I wasn't successful but I did leave a gui.text_size = 22 in which overrode all the settings I was playing with under ## Mobile devices
One thing to know is that values like gui.text_size have for sole purpose to define the styles at start. Once the game is started, those value aren't used anymore, unless you totally rebuild the style from scratch. Therefore, if you want to offer a preference option letting the player change an element of the style, you need to directly change the value in the style itself ; then make Ren'py rebuild the style.

Therefore, something along the line of :
Code:
    textbutton "increase font size":
        action [ SetField( style.STYLE_NAME, "size", style.STYLE_NAME.size + 5 ), Function( style.rebuild ) ]
 
  • Like
Reactions: Doorknob22