Forum rules - please read before posting.

Feature Request: Code hook for saving global data

Chris,

Would it be possible to add a code hook (maybe a C# event) to the save system that scripts can use to save and load global data without having to modify MenuSystem.cs and SaveSystem.cs and saving the data into global variables?

Comments

  • I'll definitely need a more elaborate break-down of that.  Do you mean custom data types?  What is it exactly that you're having to do at the moment?
  • Since you already took care of my other request (clamping button length in the variable menu), maybe this one isn't necessary.

    The Dialogue System can save and load its state from a string. Currently, to piggyback Adventure Creator's save system, it stores this string in a global variable using the modifications you suggested a few months ago:

    MenuSystem.cs:
    public static void OnMenuEnable (Menu _menu)
    {
    //... existing code...
    // Add this to save the Dialogue System's state:
    if (_menu.title == "Save")
    {
    PixelCrushers.DialogueSystem.AdventureCreator.AdventureCreatorBridge.SaveDialogueSystemToGlobalVariable();
    }
    }


    SaveSystem.cs:
    private void OnLevelWasLoaded ()
    {
    //... existing code...
    // Add this to load the Dialogue System's state:
    PixelCrushers.DialogueSystem.AdventureCreator.AdventureCreatorBridge.LoadDialogueSystemFromGlobalVariable();
    }


    The Dialogue System's state is global, not restricted to a single scene, so my understanding is that I can't use a custom Reminder script.

    It would be great if there were a facility to:

    1. Hook into the save and load process without having to modify any Adventure Creator source code, and

    2. Avoid using a global variable. (Although this one was only an issue because the string is very long, which resulted in an extra-wide button in the variable menu.)
  • For the same reason you've pointed out (it's global), the best way to do it really is to use a global variable.  There were some major upgrade problems a few versions back when I started messing around with custom options data - if things work now, I'd rather leave them alone and risk things breaking again.
  • Sounds good. Now that buttons are clamped in the variable menu, this should work fine for everyone.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.