Save-Point
VX's Window_Command bug - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Tutorials (https://www.save-point.org/forum-19.html)
+--- Thread: VX's Window_Command bug (/thread-4356.html)



VX's Window_Command bug - PK8 - 09-08-2012


A few years ago, I was working on my first ever menu script (which I never ever released), I came across a bug with VX's Window_Command window. I was setting up a window that had its column_max set to 1 and its row_max (the window would allow scrolling if my menu had more choices than I specified) set to 6.

[Image: zm1f85.jpg]
I took this from an old YouTube video of mine. The text for the choices after number 6 weren't drawn.

The problem stemmed from the refresh method of the Window_Command class. Here's how the code looked:
Code:
#--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end

I added create_contents in a new line in between self.contents.clear and for i in 0...@item_max. The refresh method should look like this:
Code:
#--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end

And it fixed my problem:
[Image: 33z3474.png]