nndda / Theatre

:performing_arts: Yet another Godot dialogue addon. now using plain text files. Compatible with Godot 4.3
https://godotengine.org/asset-library/asset/2332
MIT License
8 stars 1 forks source link

Offset `Dialogue` tags with formatted variables #12

Closed nndda closed 2 weeks ago

nndda commented 4 months ago

Dialogue tags save its start position, remove itself, and its function/behaviour is called in DialogueLabel when the character is drawn/displayed at that position.

         ▼
Hi there!{wait = 0.6} Welcome to...
Pos:     10
         ▼
Hi there! Welcome to...

This works fine, even with lots of tags. The problems comes when theres a variable in the text:

                    21
                    ▼
Hi there, {player}! {wait = 0.6}Welcome to...
Hi there, {player}! Welcome to...

                    ▼
Hi there, John! Welcome to...

                    ▼
Hi there, Christopher! Welcome to...

The position remain unchanged, when its formatted. (Might be worse with BBCode too).

Currently looking for a way to offset these, using their positions and length difference of 'before' and 'after' the text is formatted.

One quick 'fix' is to just format the text before applying the tags.