Ren'Py I need help to this. The problem is use the choices menu...

Neoshocker

New Member
Apr 14, 2023
4
0
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 45, in script call
call ch0_main from _call_ch0_main
File "game/routes_menu.rpy", line 6, in script
menu:
Exception: Character expects its what argument to be a string, got [(u'Sayori', <renpy.ui.ChoiceReturn object at 0x0242D110>), (u'Monika', <renpy.ui.ChoiceReturn object at 0x0242DDB0>)].

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

Full traceback:
File "game/script.rpy", line 45, in script call
call ch0_main from _call_ch0_main
File "game/routes_menu.rpy", line 6, in script
menu:
File "C:\PROGRA~1\DOKIDO~1.1\CE01\renpy\ast.py", line 1628, in execute
choice = renpy.exports.menu(choices, self.set, args, kwargs, item_arguments)
File "C:\PROGRA~1\DOKIDO~1.1\CE01\renpy\exports.py", line 990, in menu
rv = renpy.store.menu(new_items)
File "C:\PROGRA~1\DOKIDO~1.1\CE01\renpy\character.py", line 1054, in __call__
raise Exception("Character expects its what argument to be a string, got %r." % (what,))
Exception: Character expects its what argument to be a string, got [(u'Sayori', <renpy.ui.ChoiceReturn object at 0x0242D110>), (u'Monika', <renpy.ui.ChoiceReturn object at 0x0242DDB0>)].

Windows-7-6.1.7601-SP1
Ren'Py 7.3.5.606
Thu Jun 22 12:35:48 2023


An this fail cause if is use the choices menu
 
Last edited:

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,248
3,849
Post your code for "game/routes_menu.rpy". we are not magicians, we cannot imagine what your code looks like just from exception message.

Please use "code" formatting tags when you post it.
 

Deleted member 2282952

Developing I SCREAM
Game Developer
May 1, 2020
416
869
If I was a gambling man, I would place my bet on you are not using menu: function correctly

You prob have something like:

Code:
menu:
    u'Sayori' ...
    u'Monika' ...
Thanks for playing!
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,204
Firstly... we are assuming you are writing a game or a mod to a game.
Though the fact that the file paths include C:\PROGRA~1\DOKIDO~1.1 and the characters are named "Monika" and "Sayori" strongly hint you might just be playing by Team Salvato. Especially since RenPy developers would be unlikely to testing their game in C:\Program Files.

But let's assume you are writing a game within the same universe...
I'm going to take a guess ahead of the code being posted...

Python:
    m menu:
        "Choice 1":
            pass
        "Choice 2":
            pass
(menu prefixed by character)

-or-

Python:
    menu:
        m:
            pass
        s:
            pass
(character() uses instead of choice text) - though that might work, since the character objects can parse as a string.


-or-

Python:
    menu:
        m "Monika says something as part of the menu."
        "Choice 1":
            pass
        "Choice 2":
            pass
(this one might be valid, but optional dialogue linked to character() rather than narrator)

Where m and s are Character() definitions for the characters "Monika" and "Sayori".

btw u'Sayori' is basically the string "Sayori" but held as a unicode string (hence the u' '.

The interesting line to me is Exception("Character expects its what argument to be a string, got %r." % (what,)) ... more specifically the what argument and string.
It's indicative of a character's normal dialogue, where what is the dialogue being spoken.
But what in this case could be the various choices or even the dialogue line spoken by the narrator that is sometimes used as part of the menu.

In case this turns out to be a menu, where you are choosing characters from a list... this is what it should look like...

Python:
define m = Character("Monika")
define s = Character("Sayori")

    menu:
        "[m]":
            "I picked [m]"
        "[s]":
            "I picked [s]"

Where [ ] is used to substitute the values of variables into the string text to be shown to the player.

All that said... someone might like to check if Doki Doki Literature Club includes a game/routes_menu.rpy.
 
Last edited:
  • Love
Reactions: anne O'nymous

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
Though the fact that the file paths include C:\PROGRA~1\DOKIDO~1.1 [...]
Haven't noticed it, but Windows XP ?
It's not related to the issue, but there isn't much games that should works with it now.
 

Neoshocker

New Member
Apr 14, 2023
4
0
Thank you all for your comments, I really appreciate it.
Right now I'm going to work on it to fix it once and for all, since it was causing me a tremendous headache and it's the first time this has happened to me. So, again, thanks for your answers. Have a great day.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,204
We have only guessed at answers so far.

It would be much quicker if you could post the code that is causing the error here on the forums for us to look at.

Copy/paste the code into a reply. (Better if you use ...v (insert) button on the forum toolbar, then select </> code).
Or use the Attach files button as part of your reply... and attach the game/routes_menu.rpy file to your reply.

Seeing the actual code will make it much easier for us to help you.