Page 3 of 4

Re: Best import format for easy editing?

Posted: Wed Feb 24, 2021 8:01 am
by nicmar
Hey, I almost did it! I managed to change it so that [-] is used for the end of a branch in both import and export. Great idea.

I also, (almost?) made it work with links to menu texts (which i wrote before was a bit stupid), but the super weird thing here is that it only works if I have these chars:

Code: Select all

public static readonly char SCRIPT_CHAR = '$';
public static readonly char LINK_CHAR = ';';
If I have it the other way around, which i originally had, and also change the characters in the imported text, it doesn't work. It only reads the scripts, not the links.

Code: Select all

public static readonly char SCRIPT_CHAR = ';';
public static readonly char LINK_CHAR = '$';
I can't figure it out why the characters I use would make a difference. I tried to exactly replicate the code used to read a script and added a link-property to the ParsedDialogueEntry class.

I think you told me that the JLC team wrote this code and not you, so I don't expect you to fix this for me, but it's a bit annoying that it's so close, and still doesn't fully work. I attached the code anyhow if you or anyone else is interested.

Another thing I just thought of, is that it would be kinda complicated to export the LINK-commands, and later reimport them, so I'm considering just reading the $Grow?$ link command on the fly in the StandardUISubtitlePanel class, hide the text, and send it to the correct node.

What would be a proper way to do that from within the StandardUISubtitlePanel and jump to a specific node or another conversation?

Thanks :)

Here's a simple test to read it:

Code: Select all

#99 Chippy/Test2

Chippy: Hey chef!

	[Again]
	Chef: Say that again? 	$#19$ ;script2;
	Chippy: Eh, ok.
	[-]

	[Skip]
	Chef: I wanna skip that… 	$Test$ ;script;
	Chippy: Eh, ok.
	[-]



Re: Best import format for easy editing?

Posted: Wed Feb 24, 2021 9:20 am
by Tony Li
nicmar wrote: Wed Feb 24, 2021 8:01 amI think you told me that the JLC team wrote this code and not you, so I don't expect you to fix this for me, but it's a bit annoying that it's so close, and still doesn't fully work. I attached the code anyhow if you or anyone else is interested.
Thanks for sharing your modifications. It's true that the JLC team wrote the code. But I'm planning to make it an official import format, incorporating your modifications as well. It's on the roadmap to be done "soon" (in the next 1-2 releases).
nicmar wrote: Wed Feb 24, 2021 8:01 amAnother thing I just thought of, is that it would be kinda complicated to export the LINK-commands, and later reimport them, so I'm considering just reading the $Grow?$ link command on the fly in the StandardUISubtitlePanel class, hide the text, and send it to the correct node.

What would be a proper way to do that from within the StandardUISubtitlePanel and jump to a specific node or another conversation?
I'll implement "-->[Grow?]" when I make the import an official part of the Dialogue System. (I think adding square brackets will make it clearer.)

What if you post-process for "-->[Grow?]"? After importing the conversation, loop through each dialogue entry. If you find any matches of the format "-->[X]", find the destination dialogue entry whose Menu Text is X. Then add an outgoing link to X. Rough sketch of code, completely untested, just to convey the idea:

Code: Select all

foreach (DialogueEntry entry in conversation.dialogueEntries)
{
    const string linkPattern = @"-->\[^(\])+\]";
    entry.DialogueText = Regex.Replace(linkPattern, (match) =>
    {
        // Extract the menu text from the link pattern:
        var menuText = match.Value.Substring(4, match.Value.Substring(match.Value.Length - 5));
        // Find the destination that it links to:
        var destination = conversation.dialogueEntries.Find(x => x.MenuText == menuText);
        // Add a link from entry to destination:
        var link = new Link(entry.conversationID, entry.id, destination.conversationID, destination..id));
        entry.outgoingLinks.Add(link);
        return string.Empty; // Remove link pattern from entry's text.
    });
}
If you want to jump to an entry in code instead:

Code: Select all

ConversationState state = DialogueManager.conversationModel.GetState(destinationDialogueEntry);
DialogueManager.conversationController.GotoState(state);

Re: Best import format for easy editing?

Posted: Thu Feb 25, 2021 2:09 am
by nicmar
Hey Tony, thanks a lot for the code sample and it's great to hear that official support is coming sometime in the future.

But do you mean it would be possible at some point to also export the links? I would think that only links that doesn't simply go "down in the tree" would need to be exported, but I'm not an expert of the underlying structure like you are. :)

Otherwise, it would be complicated if we do a minor edit from within the dialog system, and then do a major edit in the import/export doc. But maybe we should only write things in the doc and only import, and not export, but I'm not sure.

I'm thinking to create the basis of the dialogs with character names etc inside the editor, export it, then write everything to import back again.

Re: Best import format for easy editing?

Posted: Thu Feb 25, 2021 8:09 am
by Tony Li
Hi Niclas,

I think it's better to only write conversations in the doc. Otherwise it becomes complicated to remember whether the most recent changes are in Unity or in the docs.
nicmar wrote: Thu Feb 25, 2021 2:09 am But do you mean it would be possible at some point to also export the links? I would think that only links that doesn't simply go "down in the tree" would need to be exported, but I'm not an expert of the underlying structure like you are.
I don't understand. You should be able to link back up in the tree -- that is, link to menu items that occur earlier in the doc.

I'm now also planning import support for Yarn Spinner. Before you go too much further with JLC, I wanted to mention that Yarn may be another option.

Re: Best import format for easy editing?

Posted: Fri Feb 26, 2021 12:30 pm
by vcesauron
Hello Tony, nicmar o/

I'm really looking forward to an official support for Yarn Spinner import/export. We are currently dealing with this issue here at the studio.
Tony, can you tell how long would it take for this support to be released, approx.? If you say more than 2 months, we might have to start working on a solution ourselves, or even iterate on the JLC solution above (btw, thank you for sharing nicmar!).

Re: Best import format for easy editing?

Posted: Fri Feb 26, 2021 1:28 pm
by Tony Li
Hi,

I expect to release Yarn import around the end of March (i.e., in about a month).

Re: Best import format for easy editing?

Posted: Tue Mar 02, 2021 2:32 am
by nicmar
Very interesting, i'm having a look at the Yarn Spinner now.
nicmar wrote: ↑Thu Feb 25, 2021 8:09 am
But do you mean it would be possible at some point to also export the links? I would think that only links that doesn't simply go "down in the tree" would need to be exported, but I'm not an expert of the underlying structure like you are.
I don't understand. You should be able to link back up in the tree -- that is, link to menu items that occur earlier in the doc.
What I mean was if it was possible to both import and export dialogues, and keep the links, but your suggestion to write everything in the doc and only import from there is probably best, to avoid confusion. :)

Re: Best import format for easy editing?

Posted: Sat Apr 10, 2021 9:14 am
by vcesauron
Hello Tony!
Are you able to share any updates on the progress of this import tool? Can I expect it to be released yet in April?

Re: Best import format for easy editing?

Posted: Sat Apr 10, 2021 9:53 am
by Tony Li
Hi,

It didn't make it into DS 2.2.16, which is going through QA testing now. But it's my top priority after 2.2.16's release. (Followed by JLC import updates and Celtx import.)

I'm still aiming for an April release.

Re: Best import format for easy editing?

Posted: Thu May 20, 2021 6:07 am
by NotVeryProfessional
What's the status on this? I'd love more import options, especially from text-based format. Writing longer texts in Unity or any other editor pales compared to doing it in a text editor.