Updating [#].SimStatus after running Sort > Reorder IDs

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Jamez0r
Posts: 59
Joined: Fri Nov 20, 2020 8:18 pm

Updating [#].SimStatus after running Sort > Reorder IDs

Post by Jamez0r »

Hey Tony, hope you're doing well!

We are preparing things for sending our dialogue off to the Localization team. One of the last things we need to do is run the Sort > Reorder IDs function on each of the conversations.

We have been using Dialogue[#].SimStatus == "WasDisplayed" as a condition for some nodes in some of our conversations. We knew that down the road when we ran the "Reorder IDs" sorting that we'd have to go through and manually update those node ID#s to match the new ID#s, and, well, now here we are ;)

I opened the DialogueDatabase.asset in a text-editor and did a search for ".SimStatus" to see how many there were. Thankfully there are only 50, so it won't be too terrible, but I'm still looking to figure out the most efficient way to find and update those ID#s.

This is what I'm thinking:
1) Make a copy of the DialogueDatabase.asset and open that in a text editor.
2) Do a search for ".SimStatus", and start from the top.
3) Each search result for ".SimStatus" looks like this:
Image
4) So I can find the Conversation ID, and the NodeID like that, and then I run the "Reorder IDs" for that conversation and immediately update the Dialogue[#].SimStatus == "WasDisplayed" to the new ID#.

My question is - is there any built-in way to find out what conversation that is? AKA some way to say "open conversation number 121" within the Dialogue editor-window?

If not, I could probably write a quick tool where I input the conversation number and it tells me the conversation "name", but I figured I'd ask first!

Also if you have any other recommendations/suggestions for this process that would be better, please let me know!

Thanks for your help, as always! :)
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Updating [#].SimStatus after running Sort > Reorder IDs

Post by Tony Li »

Hi,

No, sorry, there's no built-in, scripting-free way to tell the Dialogue Editor to open a conversation by ID. However, there is a static method DialogueEditorWindow.OpenDialogueEntry() that you can call (e.g., from a custom editor script) to open the Dialogue Editor to a specific conversation and dialogue entry. Here's an editor script to do that:

Code: Select all

using UnityEngine;
using UnityEditor;
using PixelCrushers.DialogueSystem;
using PixelCrushers.DialogueSystem.DialogueEditor;

public class OpenConversationWindow : EditorWindow
{
    [MenuItem("Tools/Open Conversation...")]
    public static void Open()
    {
        GetWindow<OpenConversationWindow>("Open Conversation");
    }

    private DialogueDatabase database;
    private int conversationID;
    private int entryID;

    private void OnGUI()
    {
        database = EditorGUILayout.ObjectField("Database", database, typeof(DialogueDatabase), false) as DialogueDatabase;
        conversationID = EditorGUILayout.IntField("Conversation ID", conversationID);
        entryID = EditorGUILayout.IntField("Dialogue Entry ID", entryID);
        if (GUILayout.Button("Open")) DialogueEditorWindow.OpenDialogueEntry(database, conversationID, entryID);
    }
}
Jamez0r
Posts: 59
Joined: Fri Nov 20, 2020 8:18 pm

Re: Updating [#].SimStatus after running Sort > Reorder IDs

Post by Jamez0r »

Tony Li wrote: Thu Jan 05, 2023 8:18 pm Hi,

No, sorry, there's no built-in, scripting-free way to tell the Dialogue Editor to open a conversation by ID. However, there is a static method DialogueEditorWindow.OpenDialogueEntry() that you can call (e.g., from a custom editor script) to open the Dialogue Editor to a specific conversation and dialogue entry. Here's an editor script to do that:

Code: Select all

using UnityEngine;
using UnityEditor;
using PixelCrushers.DialogueSystem;
using PixelCrushers.DialogueSystem.DialogueEditor;

public class OpenConversationWindow : EditorWindow
{
    [MenuItem("Tools/Open Conversation...")]
    public static void Open()
    {
        GetWindow<OpenConversationWindow>("Open Conversation");
    }

    private DialogueDatabase database;
    private int conversationID;
    private int entryID;

    private void OnGUI()
    {
        database = EditorGUILayout.ObjectField("Database", database, typeof(DialogueDatabase), false) as DialogueDatabase;
        conversationID = EditorGUILayout.IntField("Conversation ID", conversationID);
        entryID = EditorGUILayout.IntField("Dialogue Entry ID", entryID);
        if (GUILayout.Button("Open")) DialogueEditorWindow.OpenDialogueEntry(database, conversationID, entryID);
    }
}
Thanks a lot Tony!
Post Reply