Showing a screen in a screen problem

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
SLim_Games
Newbie
Posts: 23
Joined: Tue Mar 20, 2018 11:37 am
itch: slim-games
Contact:

Showing a screen in a screen problem

#1 Post by SLim_Games »

Hi,
I got this weird problem that if I show a screen inside a screen some things won't work:
To be precise the "key" function doesn't work

Code: Select all

screen openPhone:
    imagemap:
        ground "extra/phoneIcon.png"
        hover "extra/phoneIconH.png"
        hotspot(1206, 1, 72, 100):
            action Show("openPhoneIcon")
screen openPhoneIcon:
    key "mouseup_4" action Hide("nonexistent_screen")
    key "mousedown_4" action Hide("nonexistent_screen")
    modal True
So I got the openPhone screen as a overlay in my game so when you press it -> it will open a new screen showing a mobile phone
and when it opens the phone the player should not be able to rollback with mousewheel and usually that can be achieved with

Code: Select all

    key "mouseup_4" action Hide("nonexistent_screen")
    key "mousedown_4" action Hide("nonexistent_screen")
but for some reason when a screen gets shown by another screen it does not work.

and $ renpy.block_rollback is not a good idea since it blocks all rollback even after closing the phone.
What can I do?
Play my game (nsfw) for free at: https://www.patreon.com/SLim_Games

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Showing a screen in a screen problem

#2 Post by Alex »

It's strange, 'cause the code works for me...
What's the difference between this sample code and your actual code?

Code: Select all

screen openPhone:
    textbutton "Press!" action Show("openPhoneIcon") align(0.95,0.05)
    
screen openPhoneIcon:
    key "rollback" action [[]]
    key "rollforward" action [[]]
    modal True
    textbutton "Close!" action Hide("openPhoneIcon") align(0.5,0.5)
    
    
# The game starts here.
label start:
    show screen openPhone
    "..."
    "1"
    "2"
    "3"
    "4"
    "5"
    "6"
    "7"
    "?"
https://www.renpy.org/doc/html/keymap.html#keymap

SLim_Games
Newbie
Posts: 23
Joined: Tue Mar 20, 2018 11:37 am
itch: slim-games
Contact:

Re: Showing a screen in a screen problem

#3 Post by SLim_Games »

Alex wrote: Sat Apr 21, 2018 7:54 am It's strange, 'cause the code works for me...
What's the difference between this sample code and your actual code?

Code: Select all

screen openPhone:
    textbutton "Press!" action Show("openPhoneIcon") align(0.95,0.05)
    
screen openPhoneIcon:
    key "rollback" action [[]]
    key "rollforward" action [[]]
    modal True
    textbutton "Close!" action Hide("openPhoneIcon") align(0.5,0.5)
    
    
# The game starts here.
label start:
    show screen openPhone
    "..."
    "1"
    "2"
    "3"
    "4"
    "5"
    "6"
    "7"
    "?"
https://www.renpy.org/doc/html/keymap.html#keymap
huh your code works.. I guess action Hide kind of doesn't work when its a screen called by another screen ... very strange.. but thank you very much :D
Play my game (nsfw) for free at: https://www.patreon.com/SLim_Games

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]