Best import format for easy editing?

Announcements, support questions, and discussion for the Dialogue System.
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: Best import format for easy editing?

Post 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.
	[-]


Attachments
JLC Dialogue Converter.zip
(18.54 KiB) Downloaded 117 times
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Best import format for easy editing?

Post 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);
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: Best import format for easy editing?

Post 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.
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Best import format for easy editing?

Post 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.
User avatar
vcesauron
Posts: 19
Joined: Tue Oct 06, 2020 11:22 am

Re: Best import format for easy editing?

Post 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!).
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Best import format for easy editing?

Post by Tony Li »

Hi,

I expect to release Yarn import around the end of March (i.e., in about a month).
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: Best import format for easy editing?

Post 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. :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
vcesauron
Posts: 19
Joined: Tue Oct 06, 2020 11:22 am

Re: Best import format for easy editing?

Post 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?
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Best import format for easy editing?

Post 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.
NotVeryProfessional
Posts: 145
Joined: Mon Nov 23, 2020 6:35 am

Re: Best import format for easy editing?

Post 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.
Post Reply