Interpolated text not displaying correctly, but only in one project

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
Imperf3kt
Lemma-Class Veteran
Posts: 2729
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Interpolated text not displaying correctly, but only in one project

#1 Post by Imperf3kt » Sun Oct 06, 2019 6:32 am

I've picked up a project that I stopped working on a couple of months ago and I've noticed an odd error.
I have three music files that play during my game and when the music begins playing, I use renpy.notify to inform the player of what the song is called.

In backups of this project, everything works fine, but in the main version it no longer works, instead just displaying the variable name, and I cannot figure out why. It was working last I remember.
I've tried clearing persistent data and forcing a recompile but neither has made any difference.
What it looks like in a backup:
Image
what it looks like in my main project:
Image

This is the code I'm using, which is identical to the code in my backups.

Code: Select all

default np = "none"
default tm = 0
define audio.tcool = "music/Too Cool.ogg"

########################

    play music tcool
    $ np = "Too Cool"
    $ tm = 5
    $ renpy.notify("Now Playing - [np]")
    
And my notify screen:

Code: Select all

screen notify(message):

    zorder 100
    style_prefix "notify"

    frame at notify_appear:
        text "[message!tq]"

    timer tm action Hide('notify')


transform notify_appear:
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0


style notify_frame is empty
style notify_text is gui_text

style notify_frame:
    ypos gui.notify_ypos

    background Frame("gui/notify.png", gui.notify_frame_borders, tile=gui.frame_tile)
    padding gui.notify_frame_borders.padding

style notify_text:
    properties gui.text_properties("notify")
    
Which as far as I can see, apart from my addition of a customisable timer (tm), is identical to a default notify screen.

Anybody got any hints about whats going on?
I'd rather not start a new project and move everything over as I've done quite an extensive amount of work on the screens in this project (including since the backup) and I'd prefer to avoid redoing it/copying it.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

User avatar
IrinaLazareva
Veteran
Posts: 367
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: IKG
Location: St.Petersburg, Russia
Contact:

Re: Interpolated text not displaying correctly, but only in one project

#2 Post by IrinaLazareva » Sun Oct 06, 2019 7:30 am

Code: Select all

    $ renpy.notify("Now Playing - %s" %np)
There is a light at the end of the tunnel, just pray it's not a train.
___
TODO: unresolved/нерешённое

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

Re: Interpolated text not displaying correctly, but only in one project

#3 Post by Imperf3kt » Sun Oct 06, 2019 7:38 am

IrinaLazareva wrote:
Sun Oct 06, 2019 7:30 am

Code: Select all

    $ renpy.notify("Now Playing - %s" %np)
Thanks, that works well, however I don't really understand it.
Any idea why it won't work how I was previously doing it? Still seems to work in older copies of my project, so it isn't something thats changed in the renpy itself.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

User avatar
IrinaLazareva
Veteran
Posts: 367
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: IKG
Location: St.Petersburg, Russia
Contact:

Re: Interpolated text not displaying correctly, but only in one project

#4 Post by IrinaLazareva » Sun Oct 06, 2019 9:04 am

Imperf3kt wrote:
Sun Oct 06, 2019 7:38 am
Any idea why it won't work how I was previously doing it?
Honestly, I'm more surprised that this method once worked...
Anyway, I don't know. The code works. The rest doesn't matter. :)
There is a light at the end of the tunnel, just pray it's not a train.
___
TODO: unresolved/нерешённое

User avatar
hell_oh_world
Regular
Posts: 175
Joined: Fri Jul 12, 2019 5:21 am
Projects: Pathfinding
Organization: NILA
Contact:

Re: Interpolated text not displaying correctly, but only in one project

#5 Post by hell_oh_world » Sun Oct 06, 2019 10:07 am

Imperf3kt wrote:
Sun Oct 06, 2019 7:38 am
IrinaLazareva wrote:
Sun Oct 06, 2019 7:30 am

Code: Select all

    $ renpy.notify("Now Playing - %s" %np)
Thanks, that works well, however I don't really understand it.
Any idea why it won't work how I was previously doing it? Still seems to work in older copies of my project, so it isn't something thats changed in the renpy itself.
Quite not sure about it though. I got a hunch that its because interpolation only works on renpy itself and not inside python. And python statements use $ or python blocks. So technically speaking, the interpolation happened inside the python which is not feasible. I mean, why bother with interpolations if you can concatenate variables easily with python or string formatting.

Post Reply

Who is online

Users browsing this forum: tapanojum