Questions for "Display" [SOLVED]

Started by Racoon, Sun 01/12/2019 11:18:29

Previous topic - Next topic

Racoon

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!


eri0o

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

You can just use a single thread for all your questions, no need to keep opening new ones.

Crimson Wizard

#3
Quote from: eri0o on Sun 01/12/2019 11:45:16
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: ags

lblMessage.Text = "my text";
gMessage.Visible = true;
int time_to_wait = Game.TextReadingSpeed * lblMessage.Text.Length;
WaitMouseKey(time_to_wait);
gMessage.Visible = false;


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 ---
Quote from: eri0o on Sun 01/12/2019 11:45:16
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: ags

void DisplayText(String text)
{
    lblMessage.Text = text;
    gMessage.Visible = true;
    int time_to_wait = Game.TextReadingSpeed * text.Length;
    WaitMouseKey(time_to_wait);
    gMessage.Visible = false;
}


Then you declare this function in GlobalScript's header:
Code: ags

import void DisplayText(String text);


And now you can use it just as you used Display, anywhere:
Code: ags

DisplayText("Hello, this is my new text displaying method.");




You can do alot of fun stuff with this approach, like adding images around your text, and more.

Racoon

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.

Racoon

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.

SMF spam blocked by CleanTalk