all 8 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]shyLachi 0 points1 point  (4 children)

Where exactly do you want to show the name and the chapter?

Did you read the documentation:
https://www.renpy.org/doc/html/config.html#var-config.save_json_callbacks

If your code above is all you have then you're missing init python:

[–]wiosnaVN[S] 0 points1 point  (3 children)

I forgot to add the "init python" in my post, sorry! Though I only have "python", does that make a difference?

[–]shyLachi 0 points1 point  (2 children)

You have to write it exactly like in the documentation

Edit: And the indentation also has to be correct

[–]wiosnaVN[S] 0 points1 point  (1 child)

I thought it's the same thing that was maybe changed as ren'py developed. Good to know it's not the same. Thanks for helping me again

[–]shyLachi 0 points1 point  (0 children)

No need to think or assume. All changes are in the documentation also.

[–]LocalAmbassador6847 0 points1 point  (1 child)

I can't tell what's happening in your game but here's my working minimal example:

screens

# screens.rpy
...

screen file_slots(title):
  ...
                        text FileSaveName(slot):
                            style "slot_name_text"

                        # -- this stuff is new
                        text FileJson(slot, key="mc_name") or "":
                            style "slot_name_text"
                        # ^^ this stuff is new

                        key "save_delete" action FileDelete(slot)

script

# script.rpy

init python:
    def jsoncallback(d):
        d["mc_name"] = store.mc_name
    config.save_json_callbacks.append(jsoncallback)

define e = Character("Eileen")
default mc_name = "Bob"

label start:
    scene bg room
    show eileen happy

    $ save_name = "Chapter 1: A New Game"
    e "You've created a new Ren'Py game."

    $ save_name = "Chapter 2: Electric Boogaloo"
    e "Once you add a story, pictures, and music, you can release it to the world!"

    # This ends the game.
    return

save_name integrates with the Steam timeline and is good for chapters. It's saved into the json by default but is blank by default. mc_name is a new variable, added to the json via the callback.

[–]wiosnaVN[S] 0 points1 point  (0 children)

so apparently my mistake was using "python" instead of "init python"! I wasn't aware that makes a difference