Making Yanfly's Combat Log Display scrollable?

● ARCHIVED · READ-ONLY
Started by Tiptank 7 posts View original ↗
  1. Can someone help me with making Yanfly's Combat Log Display appear to be scrollable? I want the log to scroll up and down by using the up/down-keys. Sadly, he wrote it with Window_Selectable so you've to scroll down every single line.

    Hope ya'll know what I mean.

    Would be grateful for some help with this issue because a scroll function for this script would be way more comfortable for the player.
  2. By scrollable do you mean something that scrolls using the mouse wheel?
  3. It should scroll using the arrow up and arrow down keys.
  4. Then do you just want it to scroll faster than just 1 line each time? Because Window_Selectable automatically scrolls when you press the down/up arrow key if you are at the bottom/top part of the window. If you just want it to go faster Window_Selectable already has that feature. If you press PageUp/PageDown it goes up and down much faster.

    EDIT1:
    First solution: scroll faster
    If you want to just use up/down instead of PageUp/PageDown and scroll faster you could use this. I didn't test it but what it does is basically overwrite the inherited method to move cursor up and down for Window_CombatLog. Even if untested it should work because it is a very simple edit. Change the CUSTOM_LINES constant to fir your needs.
    Code:
    module HYC
     
      CUSTOM_LINES = 3 # Change this to be the number of lines you want to scroll when an arrow key (up/down) is pressed.
     
    end
    
    class Window_CombatLog < Window_Selectable
     
      #--------------------------------------------------------------------------
      # * Move Cursor Down
      #--------------------------------------------------------------------------
      def cursor_down(wrap = false)
        if index < item_max - col_max || (wrap && col_max == 1)
          select((index + HYC::CUSTOM_LINES) % item_max)
        end
      end
      #--------------------------------------------------------------------------
      # * Move Cursor Up
      #--------------------------------------------------------------------------
      def cursor_up(wrap = false)
        if index >= col_max || (wrap && col_max == 1)
          select((index - HYC::CUSTOM_LINES + item_max) % item_max)
        end
      end
     
    end

    EDIT2:
    Second solution: start scrolling as soon as UP/DOWN is pressed
    Probably I understood what you mean. You want the player to be able to scroll without having to actually reach the top/bottom line to start scrolling. If that is what you want then use this one.
    Code:
    module HYC
    
      # Change the following value to be the number of lines you want to scroll each
      # time an arrow key (up/down) is pressed. WARNING: value higher than 1 might
      # make reading the top/last line impossible without using PgUP/PgDOWN.
      CUSTOM_LINES = 1
    
    end
    
    class Window_CombatLog < Window_Selectable
    
      #--------------------------------------------------------------------------
      # * Move Cursor Down
      #--------------------------------------------------------------------------
      def cursor_down(wrap = false)
        if index < item_max - col_max || (wrap && col_max == 1)
          select((self.bottom_row + HYC::CUSTOM_LINES) % item_max)
        end
      end
      #--------------------------------------------------------------------------
      # * Move Cursor Up
      #--------------------------------------------------------------------------
      def cursor_up(wrap = false)
        if index >= col_max || (wrap && col_max == 1)
          select((top_row - HYC::CUSTOM_LINES) % item_max)
        end
      end
      #--------------------------------------------------------------------------
      # * Make Cursor Invisible
      #--------------------------------------------------------------------------
      def update_cursor
        if @cursor_all
          self.top_row = 0
        elsif @index < 0
        else
          ensure_cursor_visible
        end
      #--------------------------------------------------------------------------
      # * Stop Removing
      #--------------------------------------------------------------------------
      end
    
    end
    In this last one I had to make the cursor invisible. Having the cursor immediately jumping to the last position when scrolling down (or to the top position when scrolling up) was really disturbing in my opinion. If you do not find it disturbing I can easily adjust it to make the cursor visible.
  5. [move]RGSSx Script Support[/move]
  6. @Heirukichi: The second one is exactly what I wanted. It's so much better with the cursor invisible, though. Thank you very much.
  7. I am glad it was the solution to your problem.
    Tiptank said:
    It's so much better with the cursor invisible
    I know, this is exactly why I removed it. It was quite disturbing having it and not using it to select lines.