Closed subsoap closed 4 years ago
If a wait tag is added similar to this then an action tag should be added too
The wait tag is interesting but feels a bit too game specific. Maybe a "repeat" tag that will repeat the enclosed text one or more times?
Or maybe it should be possible to specify a callback function which will be invoked when an unknown tag is encountered while parsing the text. This would allow developers to handle game specific tags while parsing text.
The "action" tag is also quite interesting. The tag could trigger a callback function which would allow developers to react to these actions/events when encountered.
Callback function methods would be cool as a way to define custom tag behavior / react to action tags. What I am doing in my project is using Broadcast to signal the data that is then used elsewhere. Playing sounds / animations / screen effects as certain text passes by.
<repeat=text:times/>
?
Another example of how I'm using action tag, when this text is truncated a particlefx is positioned on the char and plays to give an effect to make that text more special.
"<action=particles:text_emitter>Make this pretty</action>"
For the repeat tag I was thinking like this:
<repeat=10>&zwsp;</repeat>
That would work well. Then any tags that overlap would also be applied and repeat on the repeated text?
I added this tag to a custom version of RichText for my needs in a visual novel style project. It would probably be useful for others but I'm not sure if it should be a part of the main project. These are the main changes.
Then the tag is used like
<wait=30>
which inserts 30 zero width characters. This is useful in visual novel projects where you have text appearing once character at a time and you want to add small delays between actions.