[SOLVED] Help with efficient jumping between screens and labels?

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
User avatar
bluebat
Newbie
Posts: 20
Joined: Tue Nov 13, 2018 10:12 pm
Contact:

[SOLVED] Help with efficient jumping between screens and labels?

#1 Post by bluebat »

Hi again Lemmasoft, I've run into a bit of a snag with my project.

Currently, I have a screen set up so the player can view extra events and scenes from it. I couldn't figure out how to make screens function in the same way as the actual game itself, if that makes sense (like with scene changes, dialogue, sprites, etc) so I settled for jumping to a label from a screen, using "action ui.callsinnewcontext('labelnamehere')". Though this technically works, it feels cumbersome and is a bit of a mess; the scenes within the labels lag like crazy, even on my good laptop, and there's no way to access the menu/quick menu while viewing these scenes for some reason; the only way to exit them is through finishing the entire scene, or closing the game out.

So, my questions are...
1. Is there an easier, more efficient way to jump from a screen to a label (preferably one that will be lag-free)?
2. How can I enable menus/quick menus in this way, if answer 1 doesn't cover that?

Any help would be greatly appreciated. Thank you!
Last edited by bluebat on Sun Dec 20, 2020 4:00 pm, edited 1 time in total.
So much code, so little time...

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Help with efficient jumping between screens and labels?

#2 Post by hell_oh_world »

i wouldn't use this `ui.callsinnewcontext` since this is very different from a normal jump or call.
https://www.renpy.org/doc/html/screen_actions.html#Jump
using normal actions should fix the 2nd issue.

User avatar
bluebat
Newbie
Posts: 20
Joined: Tue Nov 13, 2018 10:12 pm
Contact:

Re: Help with efficient jumping between screens and labels?

#3 Post by bluebat »

hell_oh_world wrote: Fri Dec 18, 2020 5:27 am i wouldn't use this `ui.callsinnewcontext` since this is very different from a normal jump or call.
https://www.renpy.org/doc/html/screen_actions.html#Jump
using normal actions should fix the 2nd issue.
Hi again, thanks for your reply.

I've tried to replace "ui.callsinnewcontext" with both Jump and Call, but it's still impossible to access any kind of menus from the labels. I deleted persistent data to see if that would help, but no such luck. Any idea on what could be up with this?
So much code, so little time...

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Help with efficient jumping between screens and labels?

#4 Post by hell_oh_world »

can you confirm that `quick_menu` is enabled in your game?
while playing, hit `shift + o` then type `quick_menu` and enter and see if the value is True if not then you need to change it before the game starts.

Code: Select all

label start:
  $ quick_menu = True

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

Re: Help with efficient jumping between screens and labels?

#5 Post by Alex »

bluebat wrote: Fri Dec 18, 2020 3:20 am ...so I settled for jumping to a label from a screen, using "action ui.callsinnewcontext('labelnamehere')". Though this technically works, it feels cumbersome and is a bit of a mess; the scenes within the labels lag like crazy, even on my good laptop, ...
That's ok - click some more and you'll succeed in reaching the recursion depth.
Calling a label in new context means that you run it as a subroutine (like subprogram) and need to return from it to previous context. If you don't have return commands in your labels and keep calling label more and more, you going deeper and deeper... It seems that you need to jump to labels.

What's the code you are using? It's better to use screen Actions instead of ui. functions - https://www.renpy.org/doc/html/screen_actions.html

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Help with efficient jumping between screens and labels?

#6 Post by gas »

(that happen when people use YouTube or Reddit as a source).

One way to stage such extra scenes while a game is running is to
A) Add a new screen
B) Reference it to the navigation
C) Use the 'replay' functions to start the extra scenes. https://www.renpy.org/doc/html/rooms.html#replay

This way you can access extra scenes from the navigation menu ingame.
That "call in new context" thing worked in veeeeeeeery old renpy releases (and in fact was changed in the replay thing).
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
bluebat
Newbie
Posts: 20
Joined: Tue Nov 13, 2018 10:12 pm
Contact:

Re: Help with efficient jumping between screens and labels?

#7 Post by bluebat »

hell_oh_world wrote: Fri Dec 18, 2020 9:16 am can you confirm that `quick_menu` is enabled in your game?
while playing, hit `shift + o` then type `quick_menu` and enter and see if the value is True if not then you need to change it before the game starts.

Code: Select all

label start:
  $ quick_menu = True
Yes, quick_menu is enabled. It works perfectly fine within the main game itself, but whenever a label is jumped to from a screen, there's no quick menu. I've tried using both Jump and Call thanks to the help in this thread, and that helped with my lag issue, but the problem of the quick menu being missing still persists.

Converting the scenes to be replays did help a little; it made it so you can now enter and exit the scenes freely, but you still can't save/load within them (which is understandable of course, given it's a replay.) That's totally fine for the short scenes, but I have one scene in particular that's essentially a whole extra route, so save/load functionality feels necessary given its length. If I really can't figure out what's gone wrong I can always have an optional jump to the extra route's label from the start label once the player's finished the game, but I would really like to have the jump be from the Extra screen if possible...!

Thank you to everyone who has offered insight so far, though! It's all been helpful in its own right. Thanks for being patient with me. :D
So much code, so little time...

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

Re: Help with efficient jumping between screens and labels?

#8 Post by Alex »

So, what are you doing and what's the exact code you are using? Without this information it's hard to give you a proper answer...
bluebat wrote: Sat Dec 19, 2020 11:38 pm Converting the scenes to be replays did help a little; it made it so you can now enter and exit the scenes freely, but you still can't save/load within them (which is understandable of course, given it's a replay.) ...
Do you mean that you've used Replay-action to start a game instead of Start-action? If so, then everything works as it should (you unable to save game state while in replay mode).

User avatar
bluebat
Newbie
Posts: 20
Joined: Tue Nov 13, 2018 10:12 pm
Contact:

Re: Help with efficient jumping between screens and labels?

#9 Post by bluebat »

Alex wrote: Sun Dec 20, 2020 4:58 am So, what are you doing and what's the exact code you are using? Without this information it's hard to give you a proper answer...
bluebat wrote: Sat Dec 19, 2020 11:38 pm Converting the scenes to be replays did help a little; it made it so you can now enter and exit the scenes freely, but you still can't save/load within them (which is understandable of course, given it's a replay.) ...
Do you mean that you've used Replay-action to start a game instead of Start-action? If so, then everything works as it should (you unable to save game state while in replay mode).
Ah no, I'm not using replays to start the main game itself, that's still done through Start(). This is only for scenes meant to be extra unlockables after the player finishes the main game, so I've tried to do it through a screen via the main menu. But for some reason, whether I use Jump, Call or the old ui function, the new scenes start with no quick menu. Most of them are quite short so it's not a big deal, but as I mentioned in my previous post, there's one in particular that's basically a full second route, so that one could really benefit from having save/load functionality.

This is a snippet of the code I'm currently using:

Code: Select all


(A basic ShowMenu function from the main menu brings us here.)

screen ExtraScenes():
        tag menu
        add "images/ExtraScreenBackground.png"
        imagebutton:
            hover_sound "Hover.mp3"
            activate_sound "Ding.mp3"
            idle "images/OtherSide_idle.png"
            hover "images/OtherSide_hover.png"
            xpos 500 ypos 500
            focus_mask True
            action Jump('the_other_side')
For further context, "the_other_side" is a basic label in its own .rpy file, but there's nothing fancy about it. For whatever reason, doing it like this makes it so there's no quick menu. As I also mentioned before, I can always make it so the player can access the second route via the main game somehow so it's not the end of the world, but aesthetically I'd really like it to function like this. Thanks a lot for taking the time to reply!
So much code, so little time...

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

Re: Help with efficient jumping between screens and labels?

#10 Post by Alex »

bluebat wrote: Sun Dec 20, 2020 1:15 pm ...This is only for scenes meant to be extra unlockables after the player finishes the main game, so I've tried to do it through a screen via the main menu. ...
Just use Start("second_route_label_name")-action instead of Jump("second_route_label_name").
https://www.renpy.org/doc/html/screen_a ... html#Start

User avatar
bluebat
Newbie
Posts: 20
Joined: Tue Nov 13, 2018 10:12 pm
Contact:

Re: Help with efficient jumping between screens and labels?

#11 Post by bluebat »

Alex wrote: Sun Dec 20, 2020 2:17 pm
bluebat wrote: Sun Dec 20, 2020 1:15 pm ...This is only for scenes meant to be extra unlockables after the player finishes the main game, so I've tried to do it through a screen via the main menu. ...
Just use Start("second_route_label_name")-action instead of Jump("second_route_label_name").
https://www.renpy.org/doc/html/screen_a ... html#Start
That's fixed it! And to think the solution was so simple, haha. Thanks so much for your help, it's really appreciated! :mrgreen:
So much code, so little time...

Post Reply

Who is online

Users browsing this forum: Amazon [Bot], FAST WebCrawler [Crawler], LuckyT