I am getting error when I use "%" inside text.

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
YaminoOkami
Regular
Posts: 39
Joined: Fri Sep 11, 2015 6:49 pm
Projects: 17th Astral
Contact:

I am getting error when I use "%" inside text.

#1 Post by YaminoOkami »

My line in renpy is:
"And as for any task, it is always best to have 50% more energy than you need for it"

That's all the line is, just a common text to be displayed, nothing more.

And I am getting this error:
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 4012, in script
"And as for any task it is always best to have 50% more energy than you need for it"
ValueError: unsupported format character 'm' (0x6d) at index 50

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "game/script.rpy", line 4012, in script
"And as for any task it is always best to have 50% more energy than you need for it, mind is set to do that too."
File "C:\Users\Okami\renpy-6.99.12.4-sdk\renpy\ast.py", line 613, in execute
renpy.exports.say(who, what, interact=self.interact)
File "C:\Users\Okami\renpy-6.99.12.4-sdk\renpy\exports.py", line 1139, in say
what = what % tag_quoting_dict
ValueError: unsupported format character 'm' (0x6d) at index 50

Windows-7-6.1.7601-SP1
Ren'Py 6.99.12.4.2187
17th Astral 1.0

Removing "%" from text seems to fix this, but I need to use % in my text.
So how do I solve this?

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: I am getting error when I use "%" inside text.

#2 Post by kivik »

Try using %%

% is a special character used in python for string substitutions so you need to escape it, just like escaping double quotes in strings.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider]