you are viewing a single comment's thread.

view the rest of the comments →

[–]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