[special char interpolation]What am I missing?

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
Martin
Newbie
Posts: 3
Joined: Sat Apr 13, 2024 12:50 pm
Contact:

[special char interpolation]What am I missing?

#1 Post by Martin »

Renpy sdk 8.2.0
Some problem with text interpolation in renpy.say...

" %% problem" # Ok -> % problem
e "\% problem" # Ok -> % problem

label test (mess):
"[mess]"
return

$renpy.call ("test", "%% problem") # ?? -> "%% problem"

# but...
$renpy.say(None, "%% problem") # ko - > "%% problem"
# and
$renpy.say (None, "\% Problem") # ko exception 'related to the P of problem not recognized
$renpy.say (None, "\%") # ko exception (incomplete format)

As said in title, am I really missing something or is this a bug?

Thks

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

Re: [special char interpolation]What am I missing?

#2 Post by Imperf3kt »

If I understand you correctly...
try it this way

Code: Select all

label start:
    "some test."
    jump somelabel

label test (mess):
    "[mess]."
    return

label somelabel:
    $renpy.call ("test", str("% problem"))

    "test successful."
    return
    
You could also achieve it this way

Code: Select all

default testvar = ""
##################
label start:
    "some test."
    jump somelabel

label test (mess):
    "[mess]."
    return

label somelabel:
    $testvar = "% problem"
    $renpy.call ("test", testvar)

    "test successful."
    return
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Martin
Newbie
Posts: 3
Joined: Sat Apr 13, 2024 12:50 pm
Contact:

Re: [special char interpolation]What am I missing?

#3 Post by Martin »

Thanks for your answer...but for me it doesn't solve my problem
It wasn't a good idea to add (for completude?) the renpy.call case...

Real question was why do say and renpy.say have a different behavior regarding special character?

My problem is : I'm reading text in a file to display it on the screen. I want to do some interpolations in this text (could contain [var] and {tag} things)...
But I'm currently unable to display properly a % char (and some others) found in the input (best I can achieve is %% :( )

Martin
Newbie
Posts: 3
Joined: Sat Apr 13, 2024 12:50 pm
Contact:

Re: [special char interpolation]What am I missing?

#4 Post by Martin »

So nobody has an idea / workaround for this 'simple' problem :

why renpy.say doesn't work with some escape sequences when normal say works...

Should be easy ! ;)

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

Re: [special char interpolation]What am I missing?

#5 Post by Imperf3kt »

You could try the discord.

I've never used renpy.say so I have no experience with it
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: No registered users