Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Hey,


The above preparsing code only searches for <transcribe> once in a mesh, since I figured you'd have a single character talking this way and wouldn't need it to happen multiple times. Here's a modified Parse function that loops until all <transcribe> tags are cleared:


public void Parse(STMTextContainer x)
    {
        string startTag = "<" + textTag + ">";
        string endTag = "</" + textTag + ">";
        int startingPoint;
        int endingPoint;
        do
        {
            startingPoint = x.text.IndexOf(startTag);
            endingPoint = startingPoint > -1 ? x.text.IndexOf(endTag,startingPoint) : -1; //get tag after starting tag point
            //optional, where this tag ends
            if(endingPoint == -1)
            {
                endingPoint = x.text.Length;
            }
            else
            {
                //remove tag
                x.text = x.text.Remove(endingPoint, endTag.Length);
                //ending point is already accurate
            }
            //if this tag exists in STM's string...
            if(startingPoint > -1)
            {
                //remove tag
                x.text = x.text.Remove(startingPoint, startTag.Length);
                //push backwards
                endingPoint -= startTag.Length;
                //actually modify text
                Replace(x, startingPoint, endingPoint);
            }
        }
        while(startingPoint > -1);
    }