• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to assign a button to close FL's Simple HUD?

  • 94
    Posts
    11
    Years
    • Seen Jun 18, 2016
    I have the Simple HUD inserted in the game, but i also would like to give the players the option to hide it if they don't like it (with the Tab key, for example), but i have no idea of how to do it.
     
    Pretty simple. In the HUD script , after

    Code:
    return if !$Trainer # Don't draw the hud if the player wasn't defined

    add
    Code:
    return if !$game_switches[99]

    This will make it turn off when it refreshes if game switch 99 is off.

    Now the next step is to add Tab into our list of Inputs, so in PokemonControls, under module Input, add

    Code:
    TAB    =XX
    XX being the next available number.

    Then right below, under def self.buttontoKey(button)

    you're going to add
    Code:
      when Input::TAB
              return [0x09] # TAB
    to the list of inputs. 09 is the ASCII code for horizontal tab

    Now Tab can be used as an input. So lets add it to SceneMap, and make it actually do something. Make sure to put it in the loop, add

    Code:
    if Input.trigger?(Input::TAB)
      pbSEPlay("Choose") # Delete this line to remove the SE
      $game_switches[99]=!$game_switches[99]
    $hud_need_refresh = true #refreshes the hud manually, so that the change takes place immediately
    end
     
    Back
    Top