Ren'Py Jumping or calling labels from a screen.

Alfius

Engaged Member
Modder
Sep 30, 2017
2,348
4,918
Hi guys,

I'm not sure if It's possible, but I want to know if there is anyway that it's possible to call or jump to a label from a sceen in Renpy.

So I have a setup some image buttons inside a screen. I want to completely jump out of the the existing place in my game.

I have a default label where everything is basically reset and it allows you to continue your game from there.

So I want to do a sequence of labels (They call each other) and then return to my default label. But I want my starting point to be from my imagebutton on my screen and not a menu item.

I hope it makes sense!?

Here is the error I get.

Code:
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.

line 80: u'jump' is not a keyword argument or valid child for the screen statement.  
Ren'Py Version: Ren'Py 7.3.4.596
Sun May 17 16:02:58 2020
Disclaimer: My renpy skills are limited, but I'm learning at a rapid pace now :)
 
Last edited:

barotok

New Member
Apr 30, 2019
13
10
Hi guys,

I'm not sure if It's possible, but I want to know if there is anyway that it's possible to call or jump to a label from a sceen in Renpy.
You only need to write in the action Jump instead of jump
Code:
screen myscreen():

    imagebutton:

            idle "image.png"
            hover "hover.png"
            action Jump("mylabel")
or I you want to also hide your screen
action [Jump("mylabel"),Hide("myscreen")]
 
  • Like
Reactions: Alfius

Alfius

Engaged Member
Modder
Sep 30, 2017
2,348
4,918
Thanks, will try this shortly and let you know...
(Like I said, my skills are very limited ;) )
 

Alfius

Engaged Member
Modder
Sep 30, 2017
2,348
4,918
So thanks for everything so far...but I'm still missing something...
Code:
screen Replay():
   frame:
          blah..blah... code
                  imagebutton idle im.FactorScale(imgname, 0.15):
                             xysize(160,100)
                             focus_mask True
                             action Jump ("replaylink")

label replaylink:
     if renpy.get_screen("Replay"):
     init python:
          renpy.hide_screen("Replay");
     scene 27 01 00
So everything works perfectly, except the "Replay" screen does not get hidden.
I tried various different ways of writing the hide_screen function. This was just my last iteration with the init python:

(Replay is shown with a toggle button, so I know logic works as I can manually hide the screen with my toggle button)


Managed to figure this out. Thanks for the help in the previous post. :D

PS. Any tips to navigate the code tags on the forum? It seems to go haywire as soon as I start editing code losing all formatting from my Renpy code editor.
 
Last edited:

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
Any tips to navigate the code tags on the forum? It seems to go haywire as soon as I start editing code losing all formatting from my Renpy code editor.
The forum editor isn't a great place to edit anything except the simplest of code. Not least because indenting so important to RenPy isn't always easy to duplicate.

What I tend to do is edit things in the associated RenPy editor (in my case, Atom) and then copy-paste the resulting code here to the site. Atom is quite good for stuff like this, because it will automatically converts tab characters into spaces. I would even go so far to copy-paste code from the forums into Atom, edit it and then copy-paste it back again once I've made the changes I needed to.

As far as code tags...
[code]This is code[/code] is the standard way to show code. And looks like this:

Code:
# This is code

A slight improvement for this is to use [code=python]This is code[/code] instead. Since RenPy is based on Python, the site will color things when it recognizes python style code.

Python:
# This is code

Finally, there is the "inline code" tag, which is useful for showing code snippets when you don't want to use the full [code] window. So for example, [icode]default my_var1 = False[/icode] looks like default my_var1 = False

All these tags are available from the site editor toolbar. Look for the button around the middle of the bar that looks like "...▼".
 
  • Like
Reactions: Alfius

Alfius

Engaged Member
Modder
Sep 30, 2017
2,348
4,918
The forum editor isn't a great place to edit anything except the simplest of code. Not least because indenting so important to RenPy isn't always easy to duplicate.

What I tend to do is edit things in the associated RenPy editor (in my case, Atom) and then copy-paste the resulting code here to the site. Atom is quite good for stuff like this, because it will automatically converts tab characters into spaces. I would even go so far to copy-paste code from the forums into Atom, edit it and then copy-paste it back again once I've made the changes I needed to.

As far as code tags...
[code]This is code[/code] is the standard way to show code. And looks like this:

Code:
# This is code

A slight improvement for this is to use [code=python]This is code[/code] instead. Since RenPy is based on Python, the site will color things when it recognizes python style code.

Python:
# This is code

Finally, there is the "inline code" tag, which is useful for showing code snippets when you don't want to use the full [code] window. So for example, [icode]default my_var1 = False[/icode] looks like default my_var1 = False

All these tags are available from the site editor toolbar. Look for the button around the middle of the bar that looks like "...▼".
Thanks I actually though as much. I'm also using Atom.

It was just that sometimes I want to adjust my actual code here on the forum to illustrate my problem. But noted...do all you editing in Atom with example and just past here within code tags.