All Questions

Community

D
ryanrom5
posted to: The Skip button

Autoskip Button Bug

Hello Nathan,

Thank you for the amazing course. I ran into a bug with the autoskip button that I've been trying to work around for awhile, I'm wondering if you knew of an easy solution?

Bug: With the "shortcut" hotkey assigned to skip text, if you hold the key down until you arrive at a choices prompt, it disables/hides the skip button. With the button hidden/disabled, the shortcut key does not register an "on_button_released" (keeping its pressed = true state) and immediately skips text after the choice was made, until you press and release the skip button again.

I tried a few fixes with no perfect solutions:

1) I tried setting _skip_button.pressed = false, just before the _skip_button.hide() call. But Godot wont let me modify the pressed state via code at all for some strange reason. I did a debug print and confirmed it will not change unless you click with a ui_accept action key, or use the shortcut method.

2) I also tried the input via code, without the shortcut method. This worked just fine in terms of starting and stopping the text skip, however, the button doesn't get visibly pressed when I hit the hotkey, only when I click with the mouse. This is because I am calling the button down/up functions directly in my input conditional. The hotkey is never actually pressing the button or raising the signals for button down/up.


Is there a way to press the button with the hotkey (to change the pressed state) AND to deactivate the pressed state when the choices dialogue pops up (so it doesn't skip text immediately afterwards)?


Thank you!

  

  • D
    ryanrom5 replied

    Hi Nathan,

    I know you are on vacation, but just wanted to say I figured it out.

    I didn't realize you can use the shortcut key for the "pressed" look of the button, AND do an _unhandled_input check for the button up check that prevents the text skip after resuming. Thank you for the course, it helps a lot!

  • Nathan Lovato replied

    Thanks for sharing the solution!

    Note that in general, for user interface, you'll want to favor _gui_input(). This function exists only for control nodes and only receives input when the control is in focus (like when you press or release a button).