Page 1 of 1

[HOWTO] How To: Process Custom Tags in Ink

Posted: Mon Jul 25, 2022 8:45 am
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);
    }
}