Jibble

Author Topic: Questions for "Display" [SOLVED]  (Read 179 times)

Questions for "Display" [SOLVED]
« on: 01 Dec 2019, 11:18 »
Hello again,

Where can I set where the "Display" text appears? I wish for all text to appear at the buttom of the screen. I know there is a DisplayAt function, but is there a easier way than to change all the Display function I already did?

And also, I don´t want the animations to stop when text is displayed. How do I do that?

I really come across a alot of questions that mostly take me a long time to figure out, even if I search the manual. Would someone be willing to let me ask this questions per private message so I don´t need to make a thread every time? I would be super grateful!

« Last Edit: 11 Dec 2019, 23:47 by Racoon »

Re: Questions for "Display"
« Reply #1 on: 01 Dec 2019, 11:45 »
Make a function for displaying text and use it instead of Display directly, then you can change it's behavior later. There's a find all command in the Editor so you can replace by your function.

A way to create a non-blocking way to show text is making your own, using a GUI with a label and changing the text in the label and closing the GUI by clicking on it.

You can always perform a search on the forums so it's best to ask here : https://www.google.com/search?q=show+text+without+blocking+site%3A+adventuregamestudio.co.uk

Khris

  • partook in silencing a crtitc despite facts
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Re: Questions for "Display"
« Reply #2 on: 01 Dec 2019, 18:39 »
You can just use a single thread for all your questions, no need to keep opening new ones.
Fail at Floaty Rog' now!  still having to deal with what games are going through

Re: Questions for "Display"
« Reply #3 on: 01 Dec 2019, 18:54 »
A way to create a non-blocking way to show text is making your own, using a GUI with a label and changing the text in the label and closing the GUI by clicking on it.

I think you may also just use Wait with GUI. Depends on how much do you want to allow happen on the background.

IIRC following is enough to keep animations playing (and repeatedly_execute_always running). Assuming you have a GUI gMessage which has a label lblMessage:
Code: Adventure Game Studio
  1. lblMessage.Text = "my text";
  2. gMessage.Visible = true;
  3. int time_to_wait = Game.TextReadingSpeed * lblMessage.Text.Length;
  4. WaitMouseKey(time_to_wait);
  5. gMessage.Visible = false;
  6.  

Now, if you think: "wow that's lots of lines, compared to calling Display, do I have to put this everywhere?"

This is where we come to ---
Make a function for displaying text and use it instead of Display directly, then you can change it's behavior later. There's a find all command in the Editor so you can replace by your function.

You may make a function in GlobalScript (or another script module) like this:
Code: Adventure Game Studio
  1. void DisplayText(String text)
  2. {
  3.     lblMessage.Text = text;
  4.     gMessage.Visible = true;
  5.     int time_to_wait = Game.TextReadingSpeed * text.Length;
  6.     WaitMouseKey(time_to_wait);
  7.     gMessage.Visible = false;
  8. }
  9.  

Then you declare this function in GlobalScript's header:
Code: Adventure Game Studio
  1. import void DisplayText(String text);
  2.  

And now you can use it just as you used Display, anywhere:
Code: Adventure Game Studio
  1. DisplayText("Hello, this is my new text displaying method.");
  2.  



You can do alot of fun stuff with this approach, like adding images around your text, and more.
« Last Edit: 01 Dec 2019, 18:56 by Crimson Wizard »

Re: Questions for "Display"
« Reply #4 on: 03 Dec 2019, 00:26 »
Thanks for your answers! I will try if I can make it work tomorrow and let you know how it worked out :)

I was not sure if it was okay to keep asking questions in the same thread since it said in the "Read first" thread that you should use a specific subject for your thread. But if everybody is ok with it, I will ask questions in one thread.

Re: Questions for "Display"
« Reply #5 on: 05 Dec 2019, 19:32 »
Again, thanks so much Crimson Wizard. It is working perfectly fine and I am super happy right now. I can understand what you did in the script, but I wouldn´t have been able to do it by myself. I think I understand a little bit more about GUIs now.