Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Showing text messages one at a time

Hi, I was trying to modify a default script lately but then I noticed that the window doesn't work as expected.

Whenever I try to show a message on... let's say it's some help window during a battle... one after another, it makes all the messages appear at once (it looks terrible) or it only displays the last message and that's all I can read, even if it was supposed to show up to 4 or 10 messages in a row...

I tried using some @wait_count, for, while, loop to achieve this... At the end I couldn't make it work properly.

Code:
messages = ['I won't give up', 'Yes, you will', 'No, I won't']

for a in messages

  @help_window.set_text(a, 1)

  @help_window.update while @wait_count == 0

end

but this code didn't work...
 
Do you think that was helpful? Com'on, be serious.

Is anyone else able to tell me what I should do? It doesn't matter if the example above doesn't work, I post it just to give you an idea of what I have tried in vain to get it work properly.

Seriously, I'm asking for help, not for some moronic comments. I know it sounds hard, but man, his comment didn't provide some real clue of what the problem actually is. I'm not unable to make a decent script, I've posted several scripts already and they work, even if they don't look eye-candy-ish.
 
kyonides":1ofynnt0 said:
or it only displays the last message and that's all I can read, even if it was supposed to show up to 4 or 10 messages in a row...

Code:
messages = ['I won't give up', 'Yes, you will', 'No, I won't']

for a in messages

  @help_window.set_text(a, 1) # This breaks it

  @help_window.update while @wait_count == 0

end

Set_text overwrites the old text. You need some way to keep all the text you have displayed at once. Maybe overwrite set text, add a new parameter that's the line number (and change the draw_text part to like {self.contents.draw_text(4, line * 24, self.width - 40, 32, text, align)}), and another that's a boolean for if you want to clear the existing text or not.

Of course this would only apply to Window_Help's set_text method, but other situations would be similar.
Of course, doing this only lets you do lines separately. You still need something to make it wait between drawing each line.

Sorry to not be too helpful, I'm very tired .-.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top