Calling Multiple Screens

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
galadain
Regular
Posts: 31
Joined: Wed Sep 09, 2020 4:24 pm
Contact:

Calling Multiple Screens

#1 Post by galadain »

I'd like to setup a imagemap where selecting a button calls a new screen for another image map.

Code: Select all

   screen game1_p1():

     imagemap:
       ground "game1_p1_start.png"

       hotspot (33, 210, 226, 93) action Call ("game1_p1_5")
       hotspot (33, 318, 222, 98) action Call ("game1_p1_4")

   screen game1_p1_5():

     imagemap:
       ground "game1_p1_5.png"

       hotspot (33, 318, 222, 98) action Call ("game1_p1_4")
Calling the first screen works fine. How do I go directly to the next screen from WITHIN the imagemap?

galadain
Regular
Posts: 31
Joined: Wed Sep 09, 2020 4:24 pm
Contact:

Re: Calling Multiple Screens

#2 Post by galadain »

Maybe this will clarify a bit.

I know I can do it this way by jumping to labels then calling new screens each time.

Code: Select all

label game1_p1_start:

   call screen game1_p1

Code: Select all

   screen game1_p1():

     imagemap:
       ground "game1_p1_start.png"

       hotspot (33, 210, 226, 93) action Jump ("game1_p1_5")
       hotspot (33, 318, 222, 98) action Jump ("game1_p1_4")

Code: Select all

label game1_p1_5:

   call screen game1_p1_5

Code: Select all

   screen game1_p1_5():

     imagemap:
       ground "game1_p1_5.png"

       hotspot (33, 318, 222, 98) action Jump ("game1_p1_4")

Code: Select all

label game1_p1_4:

   call screen game1_p1_3
But I'd rather not keep bouncing back and forth like that. There's got to be a better way to do this.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Calling Multiple Screens

#3 Post by Imperf3kt »

You must understand what a call does, a call must return to where it was called from. So if you call multiple screens, you must make sure the game returns from each, to the screen it came from.
https://www.renpy.org/doc/html/label.ht ... -statement
https://www.renpy.org/doc/html/other.ht ... tack_depth
This can be confusing and hard to manage.

What is it you're trying to achieve, there may be better ways to achieve it.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

galadain
Regular
Posts: 31
Joined: Wed Sep 09, 2020 4:24 pm
Contact:

Re: Calling Multiple Screens

#4 Post by galadain »

Almost like a waterfall. At first the user has five button options to pick from. Then four and so on. They are only allowed three choices to get the correct combination. So if their choices are 5 to 1 and in round 1 the choose 4, then in round 2 their choices are 5, 3-1.

User avatar
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: Calling Multiple Screens

#5 Post by emz911 »

You could make a Function that calls the passed screen name.
Another easier way is to use

Code: Select all

Show("game1_p1_5") 
instead, and give your screens a:

Code: Select all

modal True

Post Reply

Who is online

Users browsing this forum: No registered users