• 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.

Modular Menu entry switch

  • 66
    Posts
    7
    Years
    • Seen May 2, 2020
    This is a pretty dumb question but I have Luka S.J's modular menu script and I want to know how you make it so that an entry for the menu only appears once a switch is activated.
    This is my entry that I made:
    Code:
    # Global Trade Station
    MenuHandlers.addEntry(:GTS,"GTS","menuGts",proc{|menu|
      scene = PokemonSave_Scene.new
      screen = PokemonSaveScreen.new(scene)
      menu.pbEndScene
      menu.endscene = false
      if screen.pbSaveScreen
        menu.close = true
        pbBGMPlay("Trade Resort - Brick Bronze OST")
        GTS.open
      else
        menu.pbStartScene
        menu.pbShowMenu
        menu.close = false
      end
    },proc{ return true })
     
    Depending on how the rest of the script looks you could suround that part with an if statement
    example

    Code:
    # Global Trade Station
    if $game_switches[99]
    MenuHandlers.addEntry(:GTS,"GTS","menuGts",proc{|menu|
      scene = PokemonSave_Scene.new
      screen = PokemonSaveScreen.new(scene)
      menu.pbEndScene
      menu.endscene = false
      if screen.pbSaveScreen
        menu.close = true
        pbBGMPlay("Trade Resort - Brick Bronze OST")
        GTS.open
      else
        menu.pbStartScene
        menu.pbShowMenu
        menu.close = false
      end
    },proc{ return true })
    end

    EDIT: Actually nevermind that. i checked the script and there already is a method

    Code:
    MenuHandlers.addEntry(:NAME,"Text displayed","icon name",proc{|menu|
      # your lines of code go here
      # keep in mind that the 'proc{|menu| ' part always has to be like this
      # for every entry in your menu, when you go about defining the actual
      # functionality that is run when the player selects that menu element
      }
    },proc{
      # block of code that checks if the player has access to the menu element
      # MUST ALWAYS return a boolean expression
      # or if you want the player to always be able to trigger this:
      return true
    })
     
    Last edited:
    Back
    Top