How to check if speech overlay is seen? (issue with "click to continue" speech)

Started by Kumpel, Sun 26/03/2017 02:27:15

Previous topic - Next topic

Kumpel

Is there a command to check if a speech text overlay is visible atm?
If not, do you guys see another solution for the followng problem?

Little prologue:
I have a TwoClickHandler game with a not automatic speech (click to continue, needed in my educational project). The player character can sit on a chair if I click left on the hotspot. While sitting, the character gets a new speech view and of course should not move. But the player can still look at things and talk about them or "use" a wall clock to wait for his appointment (which is the little puzzle).
If the player wants to stand upand walk around again, he can click with left on the ground and the character stands up.

I coded it like this:
Code: ags
//function hChair_Interact()
if (...)
  {
   player.Walk(335, 175, eBlock, eWalkableAreas);
   Wait(20);
   player.FaceDirection(eDirectionUp, eBlock);
   Wait(5);
   player.LockViewFrame(70, 0, 0);
   waitphase = true; //true if player sits.
   player.SpeechView = 78; //Sitting view
  }

//function rep_exec()
if (waitphase == true) 
{
 if (((mouse.IsButtonDown(eMouseLeft)) && (GetLocationType(mouse.x, mouse.y) == eLocationNothing))) //leftclick on the walkable area or 
 {
  player.ChangeView(9);
  player.SpeechView = 10;
  player.UnlockView();
  player.Walk(player.x, player.y+2, eBlock, eAnywhere);
  waitphase = false;
 }
}


Here is the problem with this setup:
When the char looks f.e. at a sign, he talks two lines of speech about it and if the player clicks away the last line of the speech while the cursor is on a walkable area, the char stands up. This is annoying because now the player needs to sit down the char once again before he can proceed.

What I want it to do:
The player should be allowed to click away the speech with both mouse buttons (standard with TwoClickHandler)
                                           +
At least one gameloop after the last speech overlay caused by the char instead of at the same time of the overlay disappearing, the game should recognize a left click on a walkable area.

My Idea:

1. if the player character talks while sitting (waitphase=true) // would if (player.Speaking) work in this case?
  --> Lock the "standing up" option in r_e_a // player won't stand up while clicking away the speech

2. if there is a player speech overlay happening and if "waitph ase=true"  // How to check the first condition?
  --> Start a timer in r_e_a that expires a very short time after the last overlay disappeared. //player won't stand up while clicking away the speech

3. if the timer is expired //second left click needed as intended
  --> Unlock the "standing up" option in r_e_a //player can click left and stand up again

How to code this?

Cassiebsg

Check Speech.SkipStyle.

You can change the skip mode in script with that. I also had a situation where I didn't want the player to skip the text (just a one liner, but wanted to make sure it was read).
So you can just:

Code: ags

Speech.SkipStyle=eSkipTime; // so only time will take the text away
// your speech lines here
Speech.SkipStyle=eSkipMouse; // or what ever mode you're using 
There are those who believe that life here began out there...

Kumpel

Thanks Cassie! That's actually a good alternative! I'll go with that. (nod)

But I am still curious. How do I check, if a speech text overlay is shown?

Crimson Wizard

Character.Speaking should work to know if character is still talking.

As for overlay, SayBackground returns overlay, but for Say there is no such thing atm.

SMF spam blocked by CleanTalk