menu: causing ValueError, unable to have simple menu in game :(

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
t3li
Newbie
Posts: 2
Joined: Thu Mar 21, 2019 3:43 am
Github: t3liph0n3
Contact:

menu: causing ValueError, unable to have simple menu in game :(

#1 Post by t3li » Sat Nov 16, 2019 3:28 am

I am getting an unsupported format character error message when my game reaches a menu.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 84, in script call
    call beginning
  File "game/story.rpy", line 16, in script
    menu:
ValueError: unsupported format character 'C' (0x43) at index 22

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

Full traceback:
  File "game/script.rpy", line 84, in script call
    call beginning
  File "game/story.rpy", line 16, in script
    menu:
  File "/usr/share/games/renpy/renpy/ast.py", line 1626, in execute
    choice = renpy.exports.menu(choices, self.set, args, kwargs, item_arguments)
  File "/usr/share/games/renpy/renpy/exports.py", line 948, in menu
    label = substitute(label)
  File "/usr/share/games/renpy/renpy/exports.py", line 913, in substitute
    return s % tag_quoting_dict
ValueError: unsupported format character 'C' (0x43) at index 22

Linux-5.3.0-19-generic-x86_64-with-Ubuntu-19.10-eoan
Ren'Py 7.3.2.320
Lost in Transition 1.0
Sat Nov 16 15:10:12 2019
The area of code, that throws the error is:

Code: Select all

    menu:
        "I like to get up early. You have a higher % of success in the morning":
            $ earlyBird = True
        "I like sleep, but have good time management":
            $ timeMan = True
My game has a multiple choice form later in the game similar to what is found at viewtopic.php?t=2899
when I comment out this menu, it works fine. But MENU: doesn't seem to work.
I have reinstalled renpy to check for a corrupted file. And also noticed other snippets of games I have that use python cause the same issue of "ValueErro: unsupported format charact 'C'..."

What is the issue?

User avatar
Per K Grok
Miko-Class Veteran
Posts: 556
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
Deviantart: pekj
itch: per-k-grok
Location: Sverige
Contact:

Re: menu: causing ValueError, unable to have simple menu in game :(

#2 Post by Per K Grok » Sat Nov 16, 2019 4:26 am

t3li wrote:
Sat Nov 16, 2019 3:28 am
I am getting an unsupported format character error message when my game reaches a menu.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 84, in script call
    call beginning
  File "game/story.rpy", line 16, in script
    menu:
ValueError: unsupported format character 'C' (0x43) at index 22

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

Full traceback:
  File "game/script.rpy", line 84, in script call
    call beginning
  File "game/story.rpy", line 16, in script
    menu:
  File "/usr/share/games/renpy/renpy/ast.py", line 1626, in execute
    choice = renpy.exports.menu(choices, self.set, args, kwargs, item_arguments)
  File "/usr/share/games/renpy/renpy/exports.py", line 948, in menu
    label = substitute(label)
  File "/usr/share/games/renpy/renpy/exports.py", line 913, in substitute
    return s % tag_quoting_dict
ValueError: unsupported format character 'C' (0x43) at index 22

Linux-5.3.0-19-generic-x86_64-with-Ubuntu-19.10-eoan
Ren'Py 7.3.2.320
Lost in Transition 1.0
Sat Nov 16 15:10:12 2019
The area of code, that throws the error is:

Code: Select all

    menu:
        "I like to get up early. You have a higher % of success in the morning":
            $ earlyBird = True
        "I like sleep, but have good time management":
            $ timeMan = True
My game has a multiple choice form later in the game similar to what is found at viewtopic.php?t=2899
when I comment out this menu, it works fine. But MENU: doesn't seem to work.
I have reinstalled renpy to check for a corrupted file. And also noticed other snippets of games I have that use python cause the same issue of "ValueErro: unsupported format charact 'C'..."

What is the issue?


%

"I like to get up early. You have a higher % of success in the morning":

You could write \% (note that it is backward slash, not the ordinary one)

or you could write

You have a higher chance of success in the morning
Image Visual Story Telling, DeviantArt Group for animations, comics, games and illustrations https://www.deviantart.com/acgi

t3li
Newbie
Posts: 2
Joined: Thu Mar 21, 2019 3:43 am
Github: t3liph0n3
Contact:

Re: menu: causing ValueError, unable to have simple menu in game :(

#3 Post by t3li » Sat Nov 16, 2019 4:38 am

Thank you.

I removed the % symbol, and it works now...

User avatar
Remix
Eileen-Class Veteran
Posts: 1311
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: menu: causing ValueError, unable to have simple menu in game :(

#4 Post by Remix » Sat Nov 16, 2019 9:14 am

In text in Ren'Py, you can also escape a percentage sign by doubling it...

Code: Select all

    eileen "I am 100%%  here"
The same concept (write the character twice) is true of other formatting characters too, like [ written as [[ and { as {{
Mad Scientist Todo List:
  • Finish Improved Event Handler
  • Implement DragonBones animation as a Creator Defined Container
  • Develop Cartoon Speech Bubble dialogue
  • Finish Bitmask collision and rebound vector system
  • Develop time based building mechanic
  • Others
  • *Find a superb artist and actually write a game*

Post Reply

Who is online

Users browsing this forum: No registered users