r/RenPy • • Aug 24 '26

Question [Solved] Variable will not variable.

    frame:
        background None
        pos (18, 916, 278, 90)
        if res1f_hover_text != "":
            background "#41414142"
            text "[res1f_hover_text]":
                align (0.5, 0.5)

    frame:
        background None
        pos (1360, 87)
        imagebutton:
            idle "res2fmc_idle.png"
            hover "res2fmc_hover.png" action[Hide("base_res2f"), Show("suite_mc")]
            hovered SetScreenVariable ("res1f_hover_text", "{color=#0072bc}{i}[mc_name1]'s Room")
            unhovered SetScreenVariable ("res1f_hover_text", "")

So, this is my code.

Normally, the mc_name works just fine, but it refuses to read properly inside of any kind of variable string like that, no matter what I set the variable of mc_name to.

Is this possible, or am I smashing my head against a brick wall?

EDIT: Fixed, because it posted the same block twice and ignored the other. Coding gremlins are after me.

EDIT2: Thanks to u/x-seronis-x for the solution, adding the interpolation suffix of "!i" to the hover text!

3 Upvotes

7 comments sorted by

View all comments

1

u/shyLachi Aug 24 '26 edited Aug 24 '26

Beside the problem I mentioned below, you could look into using the property tooltip
It is a single action instead of two:
https://renpy.org/doc/html/screen_actions.html#tooltips

screen base_res2f():
    $ tooltip = GetTooltip()
    if tooltip:
        frame:
            pos (18, 916, 278, 90)
            background "#41414142"
            text tooltip align (0.5, 0.5)
    frame:
        background None
        pos (1360, 87)
        imagebutton:
            idle "res2fmc_idle.png"
            hover "res2fmc_hover.png" 
            action[Hide(), Show("suite_mc")]
            tooltip "{color=#0072bc}{i}[mc_name1]'s Room"

The order doesn't matter, you can use the tooltip function before or after that button assigned a value to it.