Open Arylos07 opened 3 years ago
This is pretty great! ^_^
This is pretty great! ^_^
Thanks! It's not the prettiest backend solution, but it was the best way I could get it to work but has been very helpful.
Adding elipsis as an option to this would be nice. So when the text gets truncated, it will show ...
(triple dots or user customizable), indicating that there's a continuation to the sentence. Just an idea, otherwise feel free to ignore it :)
Adding elipsis as an option to this would be nice. So when the text gets truncated, it will show
...
(triple dots or user customizable), indicating that there's a continuation to the sentence. Just an idea, otherwise feel free to ignore it :)
The built in Truncate function added that the say dialog uses does have "..." by default, so any time you call it without supplying a different suffix, it will use that instead. The reason it uses <!> is because the truncated text doesn't actually show up in a different dialog box or anything; it serves as a warning to the developer from the game that the text is too long, as a way to debug just in case the counter was missed. This can be changed in the Say command by changing what suffix it uses.
Thank you for this, this is exactly what I needed!
Description
Who has had that moment of typing out a long bit of dialogue and forgot to see if it's too long? With me, way more than I care to admit.
So, this PR introduces Say Dialog character limits.
Say Dialogs now have new properties indicating the maximum text that can be displayed. These values are set by the developer based on how they design their dialogs; smaller text means larger text limits.
You can set the story text limits to 0 to turn off the counter. The counter will then display "[No Story Max Length]" and will not throw errors no matter how long you make it. This really shouldn't be done, but there are some cases where having a really long dialog box would be helpful.
Text tags do not count towards this limit, so {b}, {vpunch}, etc are not counted.
What is the current behavior?
As you type character/story text, there is no feedback of how long your text will be. Based on your Say Dialog set up, this can be problematic as you either split up text too much thinking there's too much in one say command, or you put too much in and you get some text cut off.
Granted, you could use an infinite text box or using Best Fit, but depending on your application, thay may not be the best option.
What is the new behavior?
You can now adjust the text limit values for Fungus to use. Fungus will use whatever the active flowchart will be for a specific command and will display the name of the Say Dialog that command will use next to the counter.
Anything longer than the proposed limits get an error. Say commands now also have a character counter below the story text that display this as well.
Text close to the max will make the counter yellow Text over the limit will make the counter red and show an error in the summary.
Backend changes
StringFormatter has 2 helper functions added
TextTagParser had a function edited
Important Notes
Other information
Important: because I did a silly, this PR includes changes from PR #934 which contains an optional boolean to Writer Audio. When merging this branch, 934 can be deleted as this already contains it.
Future updates could include having specific say commands ignore the text limits, just in case your Say Dialog is using Best Fit and you want just a couple commands to be a little longer than the rest, if such a feature is not added prior to merging this PR.