Looking to create a Message Log or Chat Log
I'm working on a text-based adventure game where players get fed dialog based off their decisions. I bounced back and forth between some ideas on how best to proceed, but in the end opted for a message log to display their progression to the player.
That said, I've been having trouble actually creating a working message log. I have the following set up:
- A sheet with the various lines of dialog
- The game cycles through this sheet and displays text to the player
- Each text displayed to the player is added to a variable (ie, messageLog) followed by a new line break
- An actor on screen displays messageLog
- The actor height increases by X amount each time a new message is added
The issue I'm running into is that after so many lines of text, it actually dwarfs the height of the actor displaying the text. I tried a few different solutions, such as adding 30 to the actor's height each time a new line is added (which didn't work).
I also tried another, what I thought was smarter (it wasn't), way where I would multiple the number of new lines within messageLog by 30 to determine the actor's height, thereby always having enough space to encompass the entire messageLog contents. That also didn't work.
I think, at this point, the solution I'm looking for is a way to always keep the actor's height just bigger than the height of the text it's displaying (ie, the value of messageLog). But...how do I determine the height of the displayed text? Is that even possible to determine?
I searched on here for a "message log" or a "chat log", hoping that it's already been solved/created. But I have had no luck. Perhaps I was not searching for the right parameters. In either case, I'm hoping someone has run into the same issue and has found a way around it! Thanks!