• 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!
  • Akari, Selene, Mint, Solana - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

Help Creating a Scrolling Window

  • 37
    Posts
    20
    Years
    Getting straight to the point, I want to create a scrolling list where the player can choose an option: similar to if you use the Debug window in a playtest, and you go to say, "Add Item"(the additional sprites not included, of course).
    I found two functions already in Essentials that I may be able to use: pbListWindow and pbListScreenBlock.

    Code:
    def pbListWindow(cmds,width=256)
      list=Window_CommandPokemon.newWithSize(cmds,0,0,width,Graphics.height)
      list.index=0
      list.rowHeight=24
      pbSetSmallFont(list.contents)
      list.refresh
      return list
    end

    Code:
    def pbListScreenBlock(title,lister)
      viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
      viewport.z=99999
      list=pbListWindow([],256)
      list.viewport=viewport
      list.z=2
      title=Window_UnformattedTextPokemon.new(title)
      title.x=256
      title.y=0
      title.width=Graphics.width-256
      title.height=64
      title.viewport=viewport
      title.z=2
      lister.setViewport(viewport)
      selectedmap=-1
      commands=lister.commands
      selindex=lister.startIndex
      if commands.length==0
        value=lister.value(-1)
        lister.dispose
        return value
      end
      list.commands=commands
      list.index=selindex
      loop do
        Graphics.update
        Input.update
        list.update
        if list.index!=selectedmap
          lister.refresh(list.index)
          selectedmap=list.index
        end
        if Input.trigger?(Input::A)
          yield(Input::A, lister.value(selectedmap))
          list.commands=lister.commands
          if list.index==list.commands.length
            list.index=list.commands.length
          end
          lister.refresh(list.index)
        elsif Input.trigger?(Input::C) || (list.doubleclick? rescue false)
          yield(Input::C, lister.value(selectedmap))
          list.commands=lister.commands
          if list.index==list.commands.length
            list.index=list.commands.length
          end
          lister.refresh(list.index)
        elsif Input.trigger?(Input::B)
          break
        end
      end
      lister.dispose
      title.dispose
      list.dispose
      Input.update
    end

    ...but I'm new to Ruby, and even in C++ I was so bad at programming. I'm not sure how to use these, beyond the fact that I'd have to make an entire class for pbListScreenBlock. Can anyone help me in my endeavors?
     
    How do you want to use this list of choices? As part of a dialogue with an NPC? As a debug screen (so looks don't matter)? In a new Pokégear app or something? And what do you want to list?
     
    Thanks for replying, ah...

    It'd be a list of "quest" titles--the player could accept one and would have to go and defeat the Pokemon listed in the quest. Somewhat like Monster Hunter, if you've played that. The options in the list would appear as things like "Defeat 10 Raichu," "Defeat a Golurk," etc.

    I preferably wanted the quest list as an option to look at in the PC, but if it could only be as a sign on a wall or something, that'd be fine too. The looks do matter a bit, I think I could probably handle how to make the window pretty as long as I knew how to get the scrolling part working.
     
    Last edited:
    Back
    Top