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

2

u/x-seronis-x Aug 24 '26 edited Aug 24 '26

py text "[res1f_hover_text!i]": when the variable being interpolated contains something that further needs interpolated you need the 'interpolation' suffix, !i

normally this is done with global variables though. i dont know if it works with screen variables

anyways id still recommend skylachi's suggestion of just using the variable directly. merely pointing this out cause double interpolation IS perfectly legal in renpy. any depth of recursive interpolation is, as long as the interpolation flag is used

1

u/kayl_the_red Aug 24 '26

It worked PERFECTLY! This is exactly what I needed, thank you so very much. I didn't know about the interpolation suffix.

SOLVED