SOLVED: TextReadingSpeed changeswhen DisplayTopBar is shown..

Started by Slasher, Sat 28/06/2014 08:26:22

Previous topic - Next topic

Slasher

Hi,

is there a way to amend Game.TextReadingSpeed when DisplayTopBar is shown? There does not seem to anything in autofill.

Game.TextReadingSpeed = 11 and will change to  Game.TextReadingSpeed = 8 when TopDisplay is shown and return when not shown.

cheers


Adeel

Something to give you an idea (put this in repeatedly execute):

Code: ags
if (gDisplayTopBar.Visible) Game.TextReadingSpeed = 8;
else Game.TextReadingSpeed = 11;


Does this work for you?

Slasher

Hi Adeel,

not really, for obvious reasons.

I will try other methods.

Cheers anyway.




Khris

Two words: custom function.

Code: ags
void DisplayTopB(int y, int tc, int bc, String title, String message) {
  Game.TextReadingSpeed = 8;
  DisplayTopBar(y, tc, bc, title, message);
  Game.TextReadingSpeed = 11;
}


To use it in room scripts, add this to the header:
Code: ags
import void DisplayTopB(int y, int tc, int bc, String title, String message);

Slasher

Hi Khris,

does not really perform as I would have liked. Mainly, I believe, because the string lengths are quite short and I can't seem you use - for time displayed. Hopefully it's on screen long enough for people to read it...

Be a devil if I need to whip up a gui and label instead. Display gui for x time then click off gui to close.... (roll)

Cheers

Adeel

Quote from: slasher on Sat 28/06/2014 11:41:21
Hi Adeel,

not really, for obvious reasons.

I will try other methods.

Cheers anyway.

Of course. That's because I had only proposed a general model. It wasn't meant to solve your problem. It was only meant to give you an insight since you said that there's nothing in autofill.

Khris

slasher: What do you mean? I don't understand how this doesn't do exactly what you wanted. If it still goes away too fast, just try 5 or 4 instead of 8.
Just to be absolutely clear: this function has to be used instead of calling DisplayTopBar(); it won't do anything otherwise. As in:
Code: ags
  DisplayTopB(50, 15, 22, "Khris", "Like this");


"I can't seem you use - for time displayed"  --what?

monkey0506

As an additional note, you could also set Game.MinimumTextDisplayTimeMs before and after calling DisplayTopBar to ensure the text is displayed for a minimum duration of time before disappearing. The values of TextReadingSpeed and MinimumTextDisplayTimeMs are used just-in-time when speech/display functions are called, so there's no reason this shouldn't work.

Slasher

Hi guys,

just to be clearer about it: There are numerous DisplayTops and each one will display its own message within the game so I just can't 'call the function.', can I?

Game.MinimumTextDisplayTimeMs would work but I would have to change it every time before and after (with / without a function for it).

I will look in to this more but meanwhile i'm using:  Display gui + label for [n] time and then click off gui to close.

cheers

EDIT: I was typing DisplayTopBar instead of DisplayTopB :~(

My apologies Khris ;)

Works (exactly as was said).




monkey0506

Quote from: slasher on Mon 30/06/2014 06:00:20Game.MinimumTextDisplayTimeMs would work but I would have to change it every time before and after (with / without a function for it).

This is the entire purpose of functions, especially custom ones like Khris provided. Knowing when to create a custom function (e.g., whenever you're calling more than a few lines of functionally identical code from more than one or two places in your script) is one of the most basic concepts of programming. You really should stop trying to find ways around it.

SMF spam blocked by CleanTalk