character.Say and the mouse pointer disappears

Started by zeta_san, Sat 06/01/2024 20:54:08

Previous topic - Next topic

zeta_san

Hi everyone
Happy New Year

Is there a way to make the mouse pointer disappear every time a character speaks?
(character.Say)

eri0o

The wait cursor, try giving it some sprite that is fully transparent - I think probably simply assigning sprite 0 should work.

zeta_san

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

Khris

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.

zeta_san

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

eri0o

Can you video record or explain your definition of cursor?

Khris

Yeah, you said "mouse pointer" in your first post, but now you're turning gAction invisible. Are you using a GUI as the cursor?

zeta_san

sorry, unfortunately I can't explain well and I can't link images

however I use the tumbleweed theme
the pointer is a gui

Khris

Not an ideal solution but this should work if you add it to any script's repeatedly_execute_always function:

Code: ags
  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.


zeta_san

@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:

Code: ags
  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?

Crimson Wizard

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:
Code: ags
gAction.Visible = IsInterfaceEnabled();


eri0o

Also you can detect the Speech.TextOverlay being non-null instead of checking every character for speaking - assuming you are using regular Say.

zeta_san


Snarky

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?

zeta_san

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

Snarky

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.

zeta_san

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

Khris

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.

Snarky

So Crimson Wizard's fix is arguably the logically correct solution, since it's exactly a question of the interface being enabled.

SMF spam blocked by CleanTalk