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.

Calling Window Command

Status
Not open for further replies.
Okay I was calling Window Command and no error comes up but there's like 3 Window_Commands.... and when the scene is disposed at least one or two just stay there for about 10 seconds...

This is how I call the window:

Code:
        s = $data_minigames.minigames.names
        @windowcommand_window = Window_Command.new(640, s)#[s1,s2,s3]
        @windowcommand_window.back_opacity = 160
        @windowcommand_window.y = 288
        @windowcommand_window.z = 6001

$data_minigames.minigames.names is a hash...



Can someone please help me? The Command Names I need are in that hash...... But I don't want to call them one by one.
 
I can't help you with the dispose part, unless you posted the full code.
and about the hash, try this:
Code:
@windowcommand_window = Window_Command.new(640, s.values)
 
The Calling Process:

Code:
@windowcommand_window.dispose
      @windowcommand_window = nil
      @help_window.dispose
      @help_window = nil
      # Make command window
      for i in 0...$data_minigames.minigames.names.size
        s = $data_minigames.minigames.names
        @windowcommand_window = Window_Command.new(640, s.values)#[s1,s2,s3]
        @windowcommand_window.back_opacity = 160
        @windowcommand_window.y = 288
        @windowcommand_window.z = 6001
      end
      @help_window = Window_Help.new
      @help_window.set_text("Which Minigame would you like to play?")
      @help_window.z = 6001

Data minigames:

Code:
class Data_Minigames
  attr_reader   :minigames
  def initialize
    @minigames = Game_Minigames.new
  end
end
class Game_Minigames
  attr_accessor :names
  attr_accessor :cost
  attr_accessor :points
  attr_accessor :bought
  attr_accessor :map
  def initialize
    @names = Hash.new("")
    @cost = Hash.new(0)
    @points = Hash.new(0)
    @bought = Hash.new(false)
    @map = Hash.new(0)
    #===========================================================================
    # * Minigame 00
    #===========================================================================
    @names[0] = "Path Less Traveled"
    @cost[0] = 20
    @points[0] = 50
    @bought[0] = true
    @map[0] = [1, 9, 14]
    #===========================================================================
    # * Minigame 01
    #===========================================================================
    @names[1] = "Mirror Walk"
    @cost[1] = 20
    @points[1] = 20
    @bought[1] = true
    @map[1] = [2, 9, 6]
    #===========================================================================
    # * Minigame 02
    #===========================================================================
    @names[2] = "Fire Gatherer"
    @cost[2] = 20
    @points[2] = 30
    @bought[2] = true
    @map[2] = [3, 11, 14]
  end
end

Disposing Process:

Code:
@help_window.dispose
    @windowcommand_window.dispose


I think the problem is calling the window...
 
I see what you are doing.

You are creating multiple objects, but using the same instance to refrence the objects (they stay on screen for x frames until the GarbageCollect module disposes them from the memory).

You really need to rethink what it is you are doing. It seems to me you are putting too much effort into something less complicated then you are making it.

If you want to do it that way, you can create an array of @command_windows and just push new windows everytime, but I don't recommend this because, keys and value pairs are stored randomly with no order. Trying this will virtually leave you not being able to refrence your command windows within your @command_windows array (as they will just be added randomly).

Try telling me exactly what it is you are trying to pull off. Maybe make a mock up, and I will work with you on the best solution for this.
 
Status
Not open for further replies.

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