Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: zeta_san on Sat 06/01/2024 20:54:08

Title: character.Say and the mouse pointer disappears
Post by: zeta_san on Sat 06/01/2024 20:54:08
Hi everyone
Happy New Year

Is there a way to make the mouse pointer disappear every time a character speaks?
(character.Say)
Title: Re: character.Say and the mouse pointer disappears
Post by: eri0o on Sat 06/01/2024 21:44:29
The wait cursor, try giving it some sprite that is fully transparent - I think probably simply assigning sprite 0 should work.
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Sun 07/01/2024 08:01:45
Quote from: eri0o on Sat 06/01/2024 21:44:29The wait cursor, try giving it some sprite that is fully transparent - I think probably simply assigning sprite 0 should work.

thanks eri0o but, it doesn't seem to work
Title: Re: character.Say and the mouse pointer disappears
Post by: Khris on Sun 07/01/2024 13:58:17
It works fine for me.

Are you using SayBackground() maybe? Can you give a bit more details? What happens to the cursor while a character talks?

"doesn't seem to work" is a useless problem description.
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Sun 07/01/2024 14:26:21
if I change the pointer image the image doesn't change, everything remains the same.
If I put gAction.visible=false, while the character speaks, the cursor disappears but I was wondering if there was the possibility of doing this for every time a character speaks, without having to always write it
Title: Re: character.Say and the mouse pointer disappears
Post by: eri0o on Sun 07/01/2024 14:27:31
Can you video record or explain your definition of cursor?
Title: Re: character.Say and the mouse pointer disappears
Post by: Khris on Sun 07/01/2024 15:51:08
Yeah, you said "mouse pointer" in your first post, but now you're turning gAction invisible. Are you using a GUI as the cursor?
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Sun 07/01/2024 16:49:15
sorry, unfortunately I can't explain well and I can't link images

however I use the tumbleweed theme
the pointer is a gui
Title: Re: character.Say and the mouse pointer disappears
Post by: Khris on Sun 07/01/2024 17:06:33
Not an ideal solution but this should work if you add it to any script's repeatedly_execute_always function:

  bool show = true;
  for (int i = 0; i < Game.CharacterCount; i++) if (character[i].Speaking) show = false;
  gAction.Visible = show;

You could also use a custom say command that turns off the GUI.
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Sun 07/01/2024 17:23:29
@Khris
You are great!!
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Fri 17/05/2024 20:19:59
@Khris

Quote from: Khris on Sun 07/01/2024 17:06:33Not an ideal solution but this should work if you add it to any script's repeatedly_execute_always function:

  bool show = true;
  for (int i = 0; i < Game.CharacterCount; i++) if (character[i].Speaking) show = false;
  gAction.Visible = show;

You could also use a custom say command that turns off the GUI.

I noticed that it only works with player.Say also in Dialog.

How can you set the block on every Say?
Title: Re: character.Say and the mouse pointer disappears
Post by: Crimson Wizard on Fri 17/05/2024 21:03:33
I'm not sure about what exactly do you want, but following method will make gAction invisible if there's any blocking action at all:
gAction.Visible = IsInterfaceEnabled();

Title: Re: character.Say and the mouse pointer disappears
Post by: eri0o on Fri 17/05/2024 21:40:42
Also you can detect the Speech.TextOverlay being non-null instead of checking every character for speaking - assuming you are using regular Say.
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Sat 18/05/2024 13:03:08
is it a function in the script?
Title: Re: character.Say and the mouse pointer disappears
Post by: Snarky on Sat 18/05/2024 14:31:01
Quote from: zeta_san on Fri 17/05/2024 20:19:59I noticed that it only works with player.Say also in Dialog.

Could you please try to explain again what it is that doesn't work? Looking at Khris's code, it should hide the GUI whenever anyone is speaking.

Are you saying it only works in dialogs, not at other times? Or that in dialogs it only works if you use "player.Say()" rather than "player: "? Or that it only works with the player, not other characters, and also (not?) in dialogs? Or something else?
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Sat 18/05/2024 19:27:24
yes sorry Snarky

it works but Crimson's works everywhere with all characters while Chris's only works when the character (player) speaks.

khris talked about a function that acts directly on Say.

However, I'm doing some tests
Title: Re: character.Say and the mouse pointer disappears
Post by: Snarky on Sat 18/05/2024 19:58:41
Quote from: zeta_san on Sat 18/05/2024 19:27:24it works but Crimson's works everywhere with all characters while Chris's only works when the character (player) speaks.

That is surprising. It should not be the case.
Title: Re: character.Say and the mouse pointer disappears
Post by: zeta_san on Sat 18/05/2024 20:08:13
Quote from: Snarky on Sat 18/05/2024 19:58:41That is surprising. It should not be the case.

when I have time I prepare videos with the 2 versions
Title: Re: character.Say and the mouse pointer disappears
Post by: Khris on Sun 19/05/2024 11:52:33
Quote from: Snarky on Sat 18/05/2024 19:58:41
Quote from: zeta_san on Sat 18/05/2024 19:27:24it works but Crimson's works everywhere with all characters while Chris's only works when the character (player) speaks.

That is surprising. It should not be the case.

This sounded like an engine bug at first, so I tested my code. Turns out .Speaking is only true if the character has a SpeechView assigned. I guess I can see the reasoning behind that but it should also be true while they're the subject of a .Say() call imo.

Also, to clarify: zeta_san is not talking about the mouse cursor but the action text, which by default appears above the cursor even while the interface is disabled. Which in turn could be considered a bug in the template I guess, since the action text shouldn't be displayed while the player cannot actually perform an action.
Title: Re: character.Say and the mouse pointer disappears
Post by: Snarky on Sun 19/05/2024 11:58:12
So Crimson Wizard's fix is arguably the logically correct solution, since it's exactly a question of the interface being enabled.
Title: Re: character.Say and the mouse pointer disappears
Post by: Crimson Wizard on Sun 19/05/2024 13:38:55
Quote from: Khris on Sun 19/05/2024 11:52:33Turns out .Speaking is only true if the character has a SpeechView assigned. I guess I can see the reasoning behind that but it should also be true while they're the subject of a .Say() call imo.

This is one of those historical quirks in AGS, which nobody remembers by heart.
At least it's noted in the manual here:
https://adventuregamestudio.github.io/ags-manual/Character.html#characterspeaking

Another thing that could have been added is a "Speech.SpeakingCharacter", which would be more reliable than checking "Speech.TextOverlay" for instance, as text is not shown if speech mode is "Voice only".