Is there a way to create a shortcut command ?

MisterMaya

Member
Game Developer
Apr 25, 2021
379
1,794
Hi, I'm wondering if there is a way to create a shortcut command that would look like this.

there, you have your code that is long af.

Code:
define command a:        
    if dayweek == 1:
        show screen monday
        hide screen tuesday
        hide screen wednesday
        hide screen thursday
        hide screen friday
        hide screen weekend
    elif dayweek == 2:
        hide screen monday
        show screen tuesday
        hide screen wednesday
        hide screen thursday
        hide screen friday
        hide screen weekend
    elif dayweek == 3:
        hide screen monday
        hide screen tuesday
        show screen wednesday
        hide screen thursday
        hide screen friday
        hide screen weekend
    elif dayweek == 4:
        hide screen monday
        hide screen tuesday
        hide screen wednesday
        show screen thursday
        hide screen friday
        hide screen weekend
    elif dayweek == 5:
        hide screen monday
        hide screen tuesday
        hide screen wednesday
        hide screen thursday
        show screen friday
        hide screen weekend
    elif dayweek == 6:
        hide screen monday
        hide screen tuesday
        hide screen wednesday
        hide screen thursday
        hide screen friday
        show screen weekend
and everytime you want to use it, you use a command that could look like this :

Code:
 use command a
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,385
15,298
Hi, I'm wondering if there is a way to create a shortcut command that would look like this.
Look at the documentation, more precisely the page.

This being said, you absolutely don't need a so complicated structure. I don't know what's behind your screen, so use what correspond the more to what you have.


Firstly you can use the condition directly in your screen.
If the difference is some text or some image, use it that way :
You don't have permission to view the spoiler content. Log in or register now.

If the differences are more complex, then rely on the screen statement :
You don't have permission to view the spoiler content. Log in or register now.

In both case, just show the "whatever" screen once, and let it be. It will automatically update anytime that needed.


Else, you can just rely on the screen property :
You don't have permission to view the spoiler content. Log in or register now.
Then, each time you show one of those screen, the previously shown will be automatically hidden by Ren'py for you.
 

DuniX

Well-Known Member
Dec 20, 2016
1,206
797
You might want to put some of the screen interface on its own layer and clear it with renpy.scene(layer=yourLayer).
That way you can just nuke everything and rebuild it with what you need.
 
  • Like
Reactions: MisterMaya