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.
-
Onishion
- Veteran
- Posts: 295
- Joined: Mon Apr 20, 2015 10:36 am
-
Contact:
#1
Post
by Onishion » Tue Jan 03, 2017 6:47 am
What I'd like to do is set a variable, and then show/hide images using that variable.
Code: Select all
config.layers = [ 'master', 'MyUniqueLayer2', 'MyUniqueLayer1', 'transient', 'screens', 'overlay' ]
default Var = "MyUniqueLayer1"
if X:
$ Var = "MyUniqueLayer1"
else:
$ Var = "MyUniqueLayer2"
show MyImage onlayer Var
The above code does not work, says that the layer Var doesn't exist, so the straightforward method doesn't work, but is there some way that I can do this, or am I forced to put if/then chains on each time I show/hide it so that it activates a different "show" or "hide" command with the right layer?
-
xela
- Lemma-Class Veteran
- Posts: 2481
- Joined: Sun Sep 18, 2011 10:13 am
-
Contact:
#2
Post
by xela » Tue Jan 03, 2017 8:46 am
Code: Select all
$ renpy.show("MyImage", layer=Var)
Like what we're doing? Support us at:

-
Onishion
- Veteran
- Posts: 295
- Joined: Mon Apr 20, 2015 10:36 am
-
Contact:
#3
Post
by Onishion » Tue Jan 03, 2017 11:19 am
Ok, that may work out for my purposes, I'll give it a shot. Thanks!
And just to check, if I want to put an "at Transform" property and in there, like
Code: Select all
show MyImage at MyTransform onlayer Var:
zoom .5
at_list = [MyTransform"] seems to work so far, but what would be the syntax for adding basic transforms to it like zoom .5, pos 150? Do I have to bundle all that into a prepackaged transform to access them?
-
xela
- Lemma-Class Veteran
- Posts: 2481
- Joined: Sun Sep 18, 2011 10:13 am
-
Contact:
#4
Post
by xela » Tue Jan 03, 2017 12:29 pm
Code: Select all
$ renpy.show("MyImage", layer=Var, at_list=[Transform(zoom=.5, xpos=500)])
Like what we're doing? Support us at:

-
Onishion
- Veteran
- Posts: 295
- Joined: Mon Apr 20, 2015 10:36 am
-
Contact:
#5
Post
by Onishion » Tue Jan 03, 2017 6:11 pm
Awesome, thank you.