Constant User Interface?

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
renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Constant User Interface?

#1 Post by renpyhelp »

Hi,

Is it possible to have displayable user-interface on all screens without a whole bunch of if/elif within each screen?

Like, is there a way to call the single section of code for the user-interface from something like a label?
Just trying to make the code look clean without huge lines of code for all 30+ screen sections.

Thanks.

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

Re: Constant User Interface?

#2 Post by Imperf3kt »

I have no idea what you are asking. Do you have a visual representation of what you mean?
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

renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Re: Constant User Interface?

#3 Post by renpyhelp »

Imperf3kt wrote: Tue Feb 27, 2018 10:53 pm I have no idea what you are asking. Do you have a visual representation of what you mean?
I don't right now. Basically a group of pictures that show up on screens that are mainly used for information.

Example:
Say I have 7 different pictures that show what day of the week it is. In game, it's currently Monday so I have a variable that knows it's monday. I need that specific picture displayed on my screens.

I would like to NOT have the code that checks the variable and displays the picture on every single screen section, but rather have a specific section within the code with that data and the screen runs that code by simply calling it. Hope that makes more sense.

Essentially making the variable and trigger in every single screen but essentially in one spot, and when the player enters a screen, it calls that code to run and work.

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Constant User Interface?

#4 Post by wyverngem »

So you want to show an image based on a variable? Something like this for a calander?

Code: Select all

default month = 1
default day = 1
screen overlay:
    frame:
        hbox:
            add "month%s.png"%(month)
            add "day%s.png"%(day)
This uses the %s as a placeholder for the value of month and day. You would then have an image of the two in your images folder that represent each month and day. So if it's February 1 than your images would be month2.png for February and day1 for the 1st.

renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Re: Constant User Interface?

#5 Post by renpyhelp »

That looks like what I'm exactly looking for! Thank you very much. I'll try this out now and reply whether I got it working or not. Thank you

renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Re: Constant User Interface?

#6 Post by renpyhelp »

Update: It works! I just had to alter it a little bit. Essentially wanted the time data to be shown on an interactive screen so a simple ...

add "day%s.png"%(day)

is all I need rather than the screen/frame/hbox stuff.
Again, thank you much. Being so new to renpy, I'm happy to get this working so well.

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Constant User Interface?

#7 Post by wyverngem »

No problem with %s you can use more then one by seperating them with a comma. They can even be used for the folder name where the image is found. So essentially this

Code: Select all

add "%s%s.png"%(character, photo)
Example eileen1.png

Code: Select all

add "images/%s/%s.png"%(character, photo)
It's look for the folder "eileen" and the image 1.png

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], piinkpuddiin, Semrush [Bot], snotwurm