Articy import in C#

Announcements, support questions, and discussion for the Dialogue System.
irve
Posts: 53
Joined: Fri Jan 15, 2016 9:35 am

Articy import in C#

Post by irve »

I'm trying to shorten the feedback loop for the writers. Would it be possible to somehow call PixelCrushers.DialogueSystem.Articy.ArticyConverter from withing the game?

What we'd like to do is to add a button "Update Database" which would load the XML resource and replace the currently running database. I'm currently stuck in even more stupid place:

Code: Select all

using PixelCrushers.DialogueSystem.Articy;
This code complains about not finding Articy part of the namespace. So I started thinking if I'm way off the tracks here...
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Articy import in C#

Post by Tony Li »

Hi,

PixelCrushers.DialogueSystem.Articy is an editor-only namespace. It's currently not available to runtime scripts.

If your writers are working in the Unity editor, they can run the converter and use DialogueManager.AddDatabase() to load the newly-converted database into the runtime environment. You could provide a button that calls RemoveDatabase() to remove the old version and then AddDatabase() to add the new version.

For the next release, I'll look into making the converter available to runtime scripts so you can import XML in builds. This might also be useful for player mods.
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Articy import in C#

Post by Tony Li »

Here's an example scene that demonstrates reloading a database at runtime:

ArticyImportEditorRuntime_2016-01-15.unitypackage

Currently a database named "Feature Demo" is assigned to the Runtime Database Manager. Assign your articy:draft database instead.

If you're in the Unity Editor, while playing you can re-run the articy Converter and click the Refresh Database button to see the changes reflected in the scene.

In the next version, ArticyConverter (or an equivalent class name) will be available to your runtime scripts.
irve
Posts: 53
Joined: Fri Jan 15, 2016 9:35 am

Re: Articy import in C#

Post by irve »

Thank you! We were thinking of not teaching the writers how to mess with Unity and thus the "modding pathway" was looked into.

I also have to compliment you on Dialogue System support, since this is the first question in months that I didn't find an answer for.
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Articy import in C#

Post by Tony Li »

Thanks! I'm glad the Dialogue System is working out for you!

The next version should be out at the end of January. I'll make sure it has runtime modding support for articy:draft XML files.
irve
Posts: 53
Joined: Fri Jan 15, 2016 9:35 am

Re: Articy import in C#

Post by irve »

When I get the new database from the converter; how can I swap out the existing one?
Should I iterate over controllers/triggers to swap out the reference or is it somewhat more straightforward?
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Articy import in C#

Post by Tony Li »

irve wrote:When I get the new database from the converter; how can I swap out the existing one?
Should I iterate over controllers/triggers to swap out the reference or is it somewhat more straightforward?
Call DialogueManager.RemoveDatabase() to remove the old database. Then call DialogueManager.AddDatabase() to add the new one. Note that this will reset any data in the Lua environment that's associated with the old database.

Example:

Code: Select all

DialogueManager.RemoveDatabase(DialogueManager.Instance.initialDatabase);
var database = ArticyConverter.ConvertXmlToDatabase(myXmlData);
DialogueManager.AddDatabase(database); 
You don't need to do anything with triggers. Internally, they use strings to reference conversation titles and quest titles. They don't actually have direct references to any databases.
irve
Posts: 53
Joined: Fri Jan 15, 2016 9:35 am

Re: Articy import in C#

Post by irve »

I think that I found the issue; for those who might struggle here (by looking at "info" level logs):

Initial database:

Code: Select all

Dialogue System: Lua(Conversation[92] = { Status = "", Title = "Conventions / Test without semantics", Pictures = "[]", Description = "Testing dialogue devoid of emotions", Actor = 47, Conversant = 50, Articy_Id = "0x010000110000030B", Dialog = {}})
New, imported one:

Code: Select all

Dialogue System: Lua(Conversation[92] = { Status = "", Title = "Conventions/Conventions / Test without semantics", Articy_Id = "0x010000110000030B", Description = "Testing dialogue devoid of emotions", Actor = 59, Conversant = 62, Dialog = {}})
So: starting the conversation, which is named "Conventions / Test without semantics" will certainly fail, since the ConvertXmlToDatabase() is a convenience method, which imports using the default settings. My import ignores the flow fragments.

So I'll build some settings before the import. :mrgreen:
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Articy import in C#

Post by Tony Li »

Sorry about glossing over that in my previous reply. The API reference for ArticyConverter.ConvertXmlToDatabase and related classes are here:
irve
Posts: 53
Joined: Fri Jan 15, 2016 9:35 am

Re: Articy import in C#

Post by irve »

I am using some fields for additional conditions and instructions. Would it be possible to make the Articy to Lua script conversions public?
Post Reply