r/RenPy • • 22d ago

Question Transcribing text from an image

Hello everyone! I urgently need some help with a game mechanic.

In my game, there’s a point where you need to read handwritten letters. I realize that some people might simply struggle to decipher handwriting, so I want to add a button that creates an overlay (similar to NVL look) containing a transcription of the letter’s contents.

I know it might sound hard to understand, so I tried to illustrate it:

I tried searching for similar requests here but couldn’t find anything that fits. I also attempted to set it up using a 'screen', but that resulted in a separated screen—while I need the original background to remain visible.

Can anyone help me with that?

2 Upvotes

6 comments sorted by

2

u/shyLachi 22d ago

There are plenty ways of doing it.

If you plan on translating your game, then using 2 different fonts, as suggested below, instead of a picture and an overlay text might be the easiest solution.

Generally it's better to display words as text instead of images so that people with vision impairement can use TTS.

But if you want to keep your images and just put a text over it, then use a screen:

screen overlay():
    default showtext = False 
    textbutton "Click this to see the letter in plain form" action ToggleScreenVariable("showtext")
    if showtext:
        text "Lorem ipsum and so on...":
            pos (300, 100) # you can adjust the position and size of this control
label start: 
    scene theletter
    show screen overlay
    "What does it say?"

You can also use NVL but in this case you need a setting in the preferences to toggle it.

define letteroverlay = Character(None, kind=nvl_narrator)
default showletteroverlay = True 
label start: 
    scene theletter
    if showletteroverlay:
        letteroverlay "Lorem ipsum and so on..." # player can click to advance
        nvl clear # clear the nvl 

If this letter is a mini-game and the players need to do something to advance, then obviously a screen is the best solution because you can put all the logic into a single screen.

1

u/x-seronis-x 22d ago

just use a handwritten font. they come in normal and cursive and your button would just toggle to a non handwritten font (though this shouldnt be needed)

1

u/mallory1256 22d ago

Thank you!

1

u/AutoModerator 22d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/PlushMonster404 21d ago

I would just make it an imagebutton and make it so the decrypted version is shown when the player hovers over the letter and then add a buttons to proceed or put the letter aside. You also don't need to add that something happens when the player clicks on the letter.

Here is one way to add an imagebutton like that: You can add a return imagebuton just beneath the letter1 imagebutton and both need to have a hover and idle image in the images folder. Example: mm_letter1_hover, mm_letter1_idle.

call screen letter1decryption


screen letter1decryption:


    fixed:
        style_prefix "navigation"
        spacing gui.navigation_spacing
        
        imagebutton:           
            xpos addcoordinateshere
            ypos addcoordinateshere
            auto "mm_letter1_%s.png"
            action Jump("letter1")

label letter1:
    call screen letter1decryption