Current Location Label [SOLVED]

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
yon
Regular
Posts: 153
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Location: United States
Contact:

Current Location Label [SOLVED]

#1 Post by yon » Sat Oct 30, 2021 3:16 pm

What I'd like to do is include a label which shows the general location and specific location of the main character during normal VN segments.

The top right of the UI mockup is what I'm going for. What sort of UI setup do I need to do to have that there? I'm fine with changing the value of it whenever the scene changes.

I don't plan for it to be interactive, or clickable. I just want it to be a label.
Attachments
UI Mockup.png
Last edited by yon on Tue Nov 02, 2021 5:50 pm, edited 1 time in total.

rayminator
Miko-Class Veteran
Posts: 754
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Current Location Label

#2 Post by rayminator » Sun Oct 31, 2021 11:23 am

first you do this

Code: Select all

default location = ["livingroom", "bathroom", "Kitchen"]

label start:
    $ location = "livingroom"
    show screen location
    "I am at the livingroom."

screen location():
    text "[location]"
or you can do it this way I was going post something like this
https://www.youtube.com/playlist?list=P ... z0g3mNDCuH

User avatar
yon
Regular
Posts: 153
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Location: United States
Contact:

Re: Current Location Label

#3 Post by yon » Mon Nov 01, 2021 3:57 am

I took what you had and it seems to work, though now I just have some transparent text hovering over part of the screen. That's okay, though. I think I can scrap something together to align it properly and set a background image.

I'm not sure which video you were referring to since your link goes to an entire playlist of videos. Thank you for the example code, though.

The only thing I'm still not sure of is how to integrate what seems to be an array for the location's default strings? I'm probably going to have to manually type in the new location label every time I need it to update, so it's fine if I just have the default set to something like blank text or "???", right?

felsenstern
Regular
Posts: 62
Joined: Tue Jul 11, 2017 2:13 am
Contact:

Re: Current Location Label

#4 Post by felsenstern » Mon Nov 01, 2021 8:04 pm

Not sure what he tried to achieve with the array and the following code. Because the moment when you write $ location = "livingroom" the list of ["livingroom, "bathroom", "Kitchen"] gets overwritten with a simple string.

And to position a single text line would look like:

Code: Select all

screen location():
    text "[location]":
        xpos 400
        ypos 50
or alternatively:

Code: Select all

screen location():
    text "[location]":
        pos (400, 50)
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it

User avatar
yon
Regular
Posts: 153
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Location: United States
Contact:

Re: Current Location Label

#5 Post by yon » Tue Nov 02, 2021 3:45 am

Thank you.

Post Reply

Who is online

Users browsing this forum: No registered users