Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: steptoe on Tue 26/06/2012 10:34:31

Title: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: steptoe on Tue 26/06/2012 10:34:31
Hi

EDIT: Using Game.MinimumTextDisplayTimeMs seems to do the trick.

------------------------------------------------------------------------------------------------------
I have just noticed that DisplayAt is not displaying text as Display does as it is not complying with Game.TextReadingSpeed which I have as 7.

I need to position text due to screen area.

Code (AGS) Select


  DisplayAt(30, 100, 500,  "%s %s %s %s",
  "12 years have passed since that fateful day when your parents were killed. Over the years your mind has
  been tortured by its darkside!",   
  "[[You have changed. From a mild mannered young boy to a disturbed, neurotic adolescent hell bent on
  revenge!",
  "You enrolled in all the martial arts and made great acclaim in Kodokan Goshin Jutsu, Kapap, Bartitsu and
  Karate. You have been preparing yourself to avenge your parents murders!",
  "[[You learn that the gang invloved in your parents death were part of the Polizti gang. They must pay!
  They must suffer as you have!");


Can you offer a way round this?

cheers
Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: monkey0506 on Tue 26/06/2012 15:19:23
Quote from: Red Belly on Tue 26/06/2012 10:34:31invloved

I too suffer from a deep, longing desire to have inventory. In my pants. 8-)

Regarding this issue, without doing further testing, how long was the text staying on-screen? You're creating a rather lengthy string, but my initial thought is that if it's not displaying for very long it may be calculating the display time before injecting the formatted parameters. I don't see why it would be doing that, but could possibly be a bug. You definitely shouldn't have to use Game.MinimumTextDisplayTimeMs for this...

Edit: Based on some preliminary review of the editor source, this definitely doesn't look to be a bug. The text is being formatted before being displayed. So again, how long was the text actually displaying? Also, you were setting the text reading speed first right?
Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: steptoe on Tue 26/06/2012 21:02:02
Hi Monkey

with just Game reading text set at 15 the DisplayAt was showing for about 5 seconds only (4 strings.)

Was it actually failing to read all strings and stopped after first %s?

After fiddling around I use the Game.MinimumTextDisplayTimeMs set at 40000 alonf with Game reading text and it then seemed to be ok.

steptoe


Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: monkey0506 on Tue 26/06/2012 21:40:50
Code (ags) Select
String text = "Blah blah blah";
int loops = ((text.Length / Game.TextReadingSpeed) + 1) * GetGameSpeed();


Based on this formula and I calculated roughly 550 characters in your string, it should be displaying it for about 25 seconds.

Do some debugging for me...

Code (ags) Select
DateTime *now = DateTime.Now;
int oldTime = now.RawTime;
String text = String.Format("%s %s %s %s",
  "12 years have passed since that fateful day when your parents were killed. Over the years your mind has been tortured by its darkside!",
  "[[You have changed. From a mild mannered young boy to a disturbed, neurotic adolescent hell bent on revenge!",
  "You enrolled in all the martial arts and made great acclaim in Kodokan Goshin Jutsu, Kapap, Bartitsu and Karate. You have been preparing yourself to avenge your parents murders!",
  "[[You learn that the gang invloved in your parents death were part of the Polizti gang. They must pay! They must suffer as you have!");
DisplayAt(30, 100, 500, text);
now = DateTime.Now;
Display("Text length: %d, Text reading speed: %d, Time elapsed: %d seconds!", text.Length, Game.TextReadingSpeed, now.RawTime - oldTime);


Please tell me exactly what output you get. :)
Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: steptoe on Tue 26/06/2012 21:55:30
Hi Monkey

I will give your code a test tomorrow..

cheers

steptoe
Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: monkey0506 on Thu 28/06/2012 21:44:32
Hmm..I don't know where I got 25 from. I think I was insane when I typed that. It should be closer to 37.

By the way, for historical benefit, I just wanted to note that Red Belly PM'd me the following:

Quote from: Red BellyThe script you suggested seems to work ok.

I only had game.skip_display = 0; and NO Game.TextReadingSpeed

This is what was returned:

Text length:554, Text Reading Speed:15, Time elapsed:37 seconds!

He didn't specify what changed between reportedly only showing for about 5 seconds...presumably it was something related to confusion between game.skip_display and Game.TextReadingSpeed? In any case, 37 seconds is the expected result (still don't know where I got 25 from), so it would seem that this indeed was a case of scripting error, and has been resolved. ;)

P.S. Only off by 4 characters? Hah! Pretty good guess then. :D
Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: steptoe on Thu 28/06/2012 22:15:03
Monkey

what's 4 characters between friends (laugh)

cheers a lotto  8-)
Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: Calin Leafshade on Fri 29/06/2012 11:35:29
Hold on this might still be a bug.

You skipped the bug by formatting it as a string first.

Code (AGS) Select

Display("%s %s", "lol", lmao");


is not the same as

Code (AGS) Select
String text = String.Format("%s %s", "lol", "lmao");
Display(text);


(note that im not saying it *is* a bug, merely that you sidestepped the issue with your debugging)
Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: steptoe on Fri 29/06/2012 12:05:57
Hi Calin

yes, I understand what you are saying. I will look into this.

cheers

steptoe

Title: Re: SOLVED: DisplayAt - Game.TextReadingSpeed problem.
Post by: monkey0506 on Fri 29/06/2012 16:57:54
I looked through the source and the two should be functionally equivalent. DisplayAt is definitely formatting the string before displaying it. Granted, you're right that I didn't actually test it by passing the values directly into the DisplayAt function, but the engine code is doing the same thing.