I've just discovered a behaviour that I wasn't aware of till now, and I wonder if it's intended behaviour or not.
I've got a speaking attribute enabled with my images, and my character images are assigned to a "characters" layer, to allow me to clear out all visible characters without changing the background easily. To make life easier for myself, I used config.tag_layer to automatically assign them to specific layers by default.
I made the mistake of forgetting to add one of my character's tag_layer, but they still got placed onto the "characters" layer by my code. However, as a result - the speaking attribute doesn't get triggered when they're speaking.
This is resolved by adding them to config.tag_layer, but I don't see why this should be the case at all. The character in either cases are automatically placed onto the "characters" layer, but by missing the config.tag_layer out for one character, their speaking attribute no longer triggers.
[Solved] config.speaking_attribute does not play nice with config.layers
[Solved] config.speaking_attribute does not play nice with config.layers
Last edited by kivik on Wed Jul 11, 2018 8:20 am, edited 1 time in total.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: config.speaking_attribute does not play nice with config.layers
You shouldn't be manually specifying a layer if you give a tag_layer - that's just redundancy. Other than that, the layers are independent of each other, so Ren'Py doesn't know which one to use if it's not told.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: config.speaking_attribute does not play nice with config.layers
Agreed on removing the redundancy - it was written before I was aware of tag_layer.
However, the problem itself here is that if I assign layer on show (instead of using tag_layer), the speaking attribute doesn't work.
Sample code to show this problem:
Code: Select all
define config.speaking_attribute = "speaking"
define config.layers = [ 'master', 'characters', 'transient', 'screens', 'overlay' ]
image catherine speaking:
"layered/catherine_speaking.png"
image catherine:
"layered/catherine.png"
image karen speaking:
"layered/karen_speaking.png"
image karen:
"layered/karen.png"
image anna speaking:
"layered/anna_speaking.png"
image anna:
"layered/anna.png"
define c = Character("Catherine", image="catherine")
define k = Character("Karen", image="karen")
define a = Character("Anna", image="anna")
label main_menu:
return
label start:
scene black
show catherine onlayer characters at left
show karen onlayer characters
show anna onlayer characters at right
"Hi"
c "hi"
a "hi"
k "Hi"
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: config.speaking_attribute does not play nice with config.layers
If you assign it correctly - using your tag_layer - it will work. If not, it will not. I don't consider this to be a problem.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: config.speaking_attribute does not play nice with config.layers
So you're saying that config.speaking_attribute only works with images on non-standarded layers if config.tag_layer is used in the first place? As this is the current behaviour, but I don't believe it's documented that it only works in this specific conditions?
I understood config.tag_layer as an additional tool that auto assigns images to layers, and I don't understand why it should affect whether config.speaking_attribute would work on an image or not.
Hope that makes more sense?
Re: config.speaking_attribute does not play nice with config.layers
Just done a couple of tests.
Without default config.layers setup:
- If I show the images on the screens layer (transient and overlay leads to images fading away quickly), speaking attribute doesn't work.
- If I show the images on the master layer manually, speaking attribute works as intended.
- If I use config.tag_layer and assign an image to the screens layer, then show it on the master layer manually, speaking attribute doesn't work.
- If I use config.tag_layer and assign an image to the master layer and show it on the master, speaking attribute works as intended.
- If I use config.tag_layer and assign an image to the screens layer and show it on the screens, speaking attribute works as intended.
So this makes me think there's some internal dictionary that sets the "default layer" for all images on init, and speaking attribute only works for images shown on their default layer. config.tag_layer seems to add to this dictionary for anything that aren't on master layers.
Without default config.layers setup:
- If I show the images on the screens layer (transient and overlay leads to images fading away quickly), speaking attribute doesn't work.
- If I show the images on the master layer manually, speaking attribute works as intended.
- If I use config.tag_layer and assign an image to the screens layer, then show it on the master layer manually, speaking attribute doesn't work.
- If I use config.tag_layer and assign an image to the master layer and show it on the master, speaking attribute works as intended.
- If I use config.tag_layer and assign an image to the screens layer and show it on the screens, speaking attribute works as intended.
So this makes me think there's some internal dictionary that sets the "default layer" for all images on init, and speaking attribute only works for images shown on their default layer. config.tag_layer seems to add to this dictionary for anything that aren't on master layers.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: config.speaking_attribute does not play nice with config.layers
That's correct. config.tag_layer is used to find the layer with the image on it, with the master layer being used if one is not found. You're allowed to have different images with the same tag on different layers - for example, you can have a screen with the same name as a sprite tag. (I don't recommend putting anything but a screen on the screens layer.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: config.speaking_attribute does not play nice with config.layers
Ah I think I see now:you're saying the speaking_attribute only triggers the relevant image on the default layer, because you can have the same image on different layers - so only the default layer one is affected. That makes more sense for surePyTom wrote: ↑Wed Jul 11, 2018 2:14 am That's correct. config.tag_layer is used to find the layer with the image on it, with the master layer being used if one is not found. You're allowed to have different images with the same tag on different layers - for example, you can have a screen with the same name as a sprite tag. (I don't recommend putting anything but a screen on the screens layer.)
I was only using screens layer to demonstrate the problem without adding a new layer to expand the possible reasons behind the "bug".
Thanks for the explanation. I know it's quite specific that I end up being affected by this, but would it be worth mentioning on the config.speaking_attribute documentation the default layer behaviour?
Who is online
Users browsing this forum: No registered users