Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Cursor Immobilized After Efforts to Fix "Stack Level" Error

Culex

Member

Well, I was fishing around in the forums to fix my "Stack level too deep" error. Well, that worked just fine. However, now my cursor won't move between actors in Window_MenuStatus. Here is what I had before the fix:

Code:
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 416, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    bitmap = RPG::Cache.picture("Separator01")
    src_rect = Rect.new(0, 0, 352, 175)
    self.contents.blt(16, 72, bitmap, src_rect, 45)
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 85
      actor = $game_party.actors[i]
      text = contents.text_size(actor.name).width
      draw_actor_graphic(actor, x - 40, y + 56)
      draw_actor_name(actor, x, y)
      draw_actor_level(actor, x, y + 32)
      draw_actor_state(actor, x + text + 4, y)
      draw_actor_hp(actor, x + 176, y)
      draw_actor_sp(actor, x + 176, y + 32)
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Graphic
  #--------------------------------------------------------------------------
  def refresh_graphic
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 85
      actor = $game_party.actors[i]
      self.contents.fill_rect(10, y + 8, 32, 48, Color.new(0, 0, 0, 0))
      draw_actor_graphic(actor, x - 40, y + 56)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 85, self.width - 32, 64)
    end
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias moving_graphic_update update
  def update
    moving_graphic_update
    refresh_graphic
  end
end

...and here is what I modified (the alias method at the bottom at the previous script):

Code:
  [...]
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  if @moving_graphic_update.nil?
    alias moving_graphic_update update
    def update
      @moving_graphic_update = true
      refresh_graphic
    end
  end
end

Well, the error is gone, but now I can't switch between characters in Window_MenuStatus. How can this issue be remedied?
 
alias moving_graphic_update update
def update
  @moving_graphic_update = true
    refresh_graphic
end

Problem might be that this doesn't call the original update anymore.

As far as the stack error goes, I don't see it looking at the scripts but I'm also half asleep, might be in something else. Stack errors happen when the same command calls itself over & over again if you didn't know already :)
 

Zeriab

Sponsor

Does this happen when you press F12?
If so you could try my F12 fix

You could also try using this code:

Code:
  [...]
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  if @moving_graphic_update.nil?
    alias moving_graphic_update update
    @moving_graphic_update = true
    def update
      moving_graphic_update
      refresh_graphic
    end
  end
end

*hugs*
- Zeriab
 

Culex

Member

Yeah, it was caused after I had pressed F12 only. I will take a look at your F12 fix but the code you had posted did the trick! Thanks a million! I have no further inquiries.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top