sug.: auto-remove background speech

Started by Goldmund, Thu 30/09/2004 04:12:35

Previous topic - Next topic

Goldmund

Hello,

I sometimes use random events for characters talking in a room. I use DisplaySpeechBackground for this.
Now, it often happens that even when random's value is high, the speech is triggered while the previous one is still on screen. This makes for ugly and illegible clusters.

Would it be possible to make an existing background speech auto-disappear when the character says something new?

Gilbert

#1
You can use IsOverlayValid() to check if the text is still on screen (thus you can remove it if a new line is said, or just don't display one more line of speech if the last one's still there). For example:
You can do something like:

int speechoverid;

...

ran=Random(10);
if (ran==5) {
Ã,  if (IsOverlayValid(speechoverid)Ã,  RemoveOverlay(speechoverid);
Ã,  speechoverid=DisplaySpeechBackground(EGO,"Blah!");
}



TerranRich

Yeah, but it doesn't work very well with normal speech, which is timed according to sentence length. So that "Blah" wouldn't stay on screen as long as "Hello, my name is Rich, and I'm a workaholic." Unless you use some algorithm where you set a timer for a time determined by the length of the string spoken. Something like one second per 3 words.
Status: Trying to come up with some ideas...

Gilbert

Terran, I can't get your point, did you read the thread?

TerranRich

Sorry, basically I was questioning putting up background speech before the last one "completes", so to speak. I was distracted while typing that post and it might have sounds like I was talkng about something else. :P
Status: Trying to come up with some ideas...

Gilbert

You don't need to time the speech yourself, as I mentioned:
Quote
or just don't display one more line of speech if the last one's still there
(though I only gave an example of terminating the last line immediately) if you don't want another line to be displayed before the last one was removed automatically, just do something like:

if (IsOverlayValid(speechoverid)==0)  {
   ran=Random(10);
   if (ran==5) speechoverid=DisplaySpeechBackground(EGO,"Blah!");
}

strazer

#6
QuoteSomething like one second per 3 words.

The algorithm is
  time = ((StrLen(messagetext) / game.text_speed) + 1) * GetGameSpeed();

Edit:
That's in numbers of game loops.

Goldmund

Hm, yes, I thought of the workaround the way you suggested - thanks! - but I never really understood how the "OverlayIds" work, and I daresay that I'm not a bad scripter.
Still:
1) I don't really understand the way the code works. Where this "speechoverid" gets defined, and what command defines it??

2) Don't you think that such problems should be evaded by the engine itself? It seems only logical to me that when a character "background-speaks" his previous "background speech" should be erased off the screen... unless somebody really likes the cluster effects!


Pumaman

That seems a fair enough request, that DisplaySpeechBackground should check for existing background speech for that character, and remove it if found.

SMF spam blocked by CleanTalk