Advertisement
TheSixth

Selectable Window Scroll Fix by Sixth

Sep 4th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.48 KB | None | 0 0
  1. #===============================================================================
  2. # Using the pagedown button on a selectable window when there are more items
  3. # than what can be displayed sometimes (most of the times, actually) will result
  4. # in an "over-scrolled" window with lotsa empty space left on the bottom.
  5. # This snippet prevents that from happening.
  6. # Also if the window can't be scrolled up/down anymore (or at all), and the
  7. # pageup/pagedown button is pressed, it will jump to the first/last item on the
  8. # list unless it's already there.
  9. # Put this at the top of your custom script list!
  10. # Made by: Sixth
  11. #===============================================================================
  12. class Window_Selectable < Window_Base
  13.    
  14.   def cursor_pagedown
  15.     if top_row + page_row_max < row_max
  16.       self.top_row += page_row_max
  17.       self.top_row = [self.top_row,item_max - page_row_max].min
  18.       select([@index + page_item_max, item_max - 1].min)
  19.     elsif @index != item_max - 1
  20.       select(item_max - 1)
  21.     end
  22.   end
  23.  
  24.   def cursor_pageup
  25.     if top_row > 0
  26.       self.top_row -= page_row_max
  27.       select([@index - page_item_max, 0].max)
  28.     elsif @index != 0
  29.       select(0)
  30.     end
  31.   end
  32.  
  33. end
  34.  
  35. class Scene_Title < Scene_Base
  36.  
  37.   def update
  38.     super
  39.   end
  40.  
  41. end
  42. #==============================================================================
  43. # !!END OF SCRIPT - OHH, NOES!!
  44. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement