Adding alt to images on screens

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
wyverngem
Miko-Class Veteran
Posts: 594
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:

Adding alt to images on screens

#1 Post by wyverngem » Thu Mar 07, 2019 7:23 pm

I'm probably just not seeing this, but in Ren'py can you add "alt' to images on screens?

I know it gets the error when I type this, but in a sense it would be like this;

Code: Select all

add "images/chibis/great.png" alt "Great!"
I want the self-voicing to use "Great" when the images is shown to the player. I'm using an image instead of text because it's part of the gui, but I know it's not being read when I enable my self voicing. Which for me means my brother won't have it read to him.

I've used a work around before by adding a text hidden behind the image that only shows up when the preference is available. However, sometimes it still peaks out and I know that you can use self voicing and still see the screen.

Anyone know if there's a way better way to do this?

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

Re: Adding alt to images on screens

#2 Post by Imperf3kt » Thu Mar 07, 2019 7:28 pm

Use an imagebutton and give it an action of NullAction
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

philat
Eileen-Class Veteran
Posts: 1660
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Adding alt to images on screens

#3 Post by philat » Fri Mar 08, 2019 1:23 am

alt appears to be a style property, not ATL. Try adding that? (To be clear, I haven't tested.)

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

Re: Adding alt to images on screens

#4 Post by Imperf3kt » Fri Mar 08, 2019 1:44 am

Yes, "alt" text is what self voicing uses when reading a button, hence why I suggested using an imagebutton and not an image.
I use it a lot myself.

It doesn't sound like wyverngem wants to use ATL.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

philat
Eileen-Class Veteran
Posts: 1660
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Adding alt to images on screens

#5 Post by philat » Fri Mar 08, 2019 3:44 am

...yeah I know what it does. The point is OP asked for a straight image not a button. I meant that they should try adding it to a style and not like an atl transform property directly in screen language.

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

Re: Adding alt to images on screens

#6 Post by Imperf3kt » Fri Mar 08, 2019 4:41 am

Oh okay I get what you mean now.
Never tried that myself, I always add it as part of a block.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

User avatar
wyverngem
Miko-Class Veteran
Posts: 594
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: Adding alt to images on screens

#7 Post by wyverngem » Fri Mar 08, 2019 2:22 pm

philat wrote:
Fri Mar 08, 2019 3:44 am
...yeah I know what it does. The point is OP asked for a straight image not a button. I meant that they should try adding it to a style and not like an atl transform property directly in screen language.
What does that look like. Otherwise a null image button might be a temp too.

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

Re: Adding alt to images on screens

#8 Post by Imperf3kt » Fri Mar 08, 2019 3:41 pm

philat wrote:
Fri Mar 08, 2019 3:44 am
...yeah I know what it does. The point is OP asked for a straight image not a button. I meant that they should try adding it to a style and not like an atl transform property directly in screen language.
Gave it a try, nothing happens. Also, how do you give multiple images different alts without using a new style each?

Either I was doing it wrong, or it isn't meant to be used like that.
This is how I normally use it:

Code: Select all

            imagebutton:
                auto "gui/buttons/save_%s.png" 
                action ShowMenu("save")
                tooltip "Save your progress"
                alt "save your progress"
                
The documentation appears to support this way of use as it says it is a position style property and can be used the same way as position styles, such as as part of a block, or inline.
Its strange to be in position style properties, but note that it is not in text style properties.

So my suggestion is just:

Code: Select all

screen result():
    imagebutton:
    idle "images/great.png"
    hover "images/great.png"
    action NullAction
    alt "great"
    
Last edited by Imperf3kt on Sat Mar 09, 2019 2:26 am, edited 1 time in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

philat
Eileen-Class Veteran
Posts: 1660
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Adding alt to images on screens

#9 Post by philat » Fri Mar 08, 2019 9:59 pm

Like I said it was a suggestion.*shrug* Using an imagebutton seems like a decent workaround if that's all that would work.

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

Re: Adding alt to images on screens

#10 Post by Imperf3kt » Sat Mar 09, 2019 2:25 am

It was a reasonable suggestion. It might work too, but in my testing I wasn't able to get it to do anything. But then again, I'm only a novice, so it's likely I may have made a mistake as well.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

User avatar
wyverngem
Miko-Class Veteran
Posts: 594
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: Adding alt to images on screens

#11 Post by wyverngem » Sat Mar 09, 2019 10:32 pm

I’ve been busy working on another project, but the imagebutton will work. I’ve set them up before with action. I don’t see why not with just NullAction.

Thanks guys.

Post Reply

Who is online

Users browsing this forum: Rydetox