[HOWTO] How To: Process Custom Tags in Ink

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Process Custom Tags in Ink

Post by Tony Li »

Ink doesn't have a way to define custom fields for dialogue entries, and there's really no concept of dialogue entries in Ink. The Dialogue System's Ink Import Integration automatically processes any Actor Tags on each line. (You can also tick Actor Names Precede Lines and put the actor's name at the front of the text to specify the speaker.)

If you want to process any custom tags of your own, you can make and use a subclass of DialogueSystemInkIntegration that overrides the ProcessTags method. For example, the subclass below will add a custom tag "IsAction" and set a custom dialogue entry field named "IsAction" accordingly:

Code: Select all

public class CustomDialogueSystemInkIntegration : DialogueSystemInkIntegration
{
    protected override void ProcessTags(Story activeStory, DialogueEntry entry)
    {
        Field.SetValue(entry.fields, "IsAction", false); // Assume tag doesn't exist unless we find it.
        base.ProcessTags(activeStory, entry);
    }

    protected override void ProcessTag(string tag, DialogueEntry entry)
    {
        if (tag == "IsAction") Field.SetValue(entry.fields, "IsAction", false);
        else base.ProcessTag(tag, entry);
    }
}
Post Reply