- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
I'm using dialogs as a way of NPC talking. Here's a brief outline to explain my usage.
Now this works for very short dialog messages. But if the NPC is telling the player information about the plot/universe/mythos/etc. a single liner isn't enough. What happens is because (for whatever reason) dialog boxes have a fixed size, longer strings will go out of the dialog box and possibly off screen.
The solution has been to use "\n" to try to split the message into blocks of words such that each line is exactly the width of the dialog box. This approach doesn't work unfortunately because sometimes the best "\n" would actually break up a word and that looks terrible.
Finding the best split isn't easy, and I'd rather not have to eyeball every dialog message until it looks perfectly.
I suppose I can make a very naive rule--it tries to fit the most words/characters to the width, but if it means breaking up a line, then I take however many words less. So basically I'm as greedy as possible, but I can't break up words (characters separated by whitespace). If that's the case, then I have to move them onto the next line.
I just didn't want to pre-process every string...
I mean I don't have to worry about this issue--people can just deal with the text being outside the box I suppose (would I lose points for this in a review?). But it doesn't look that good.
I'm using dialogs as a way of NPC talking. Here's a brief outline to explain my usage.
JASS:
local dialog d = CreateDialog()
local string npcMsg = "How may I help you?"
call DialogSetMessage(d, npcMsg)
call DialogAddButton(d, "Option1", ...)
...
Now this works for very short dialog messages. But if the NPC is telling the player information about the plot/universe/mythos/etc. a single liner isn't enough. What happens is because (for whatever reason) dialog boxes have a fixed size, longer strings will go out of the dialog box and possibly off screen.
The solution has been to use "\n" to try to split the message into blocks of words such that each line is exactly the width of the dialog box. This approach doesn't work unfortunately because sometimes the best "\n" would actually break up a word and that looks terrible.
Finding the best split isn't easy, and I'd rather not have to eyeball every dialog message until it looks perfectly.
I suppose I can make a very naive rule--it tries to fit the most words/characters to the width, but if it means breaking up a line, then I take however many words less. So basically I'm as greedy as possible, but I can't break up words (characters separated by whitespace). If that's the case, then I have to move them onto the next line.
I just didn't want to pre-process every string...
I mean I don't have to worry about this issue--people can just deal with the text being outside the box I suppose (would I lose points for this in a review?). But it doesn't look that good.