Help With Window_Selectable

Zansettsu

Villager
Member
Joined
Feb 2, 2015
Messages
6
Reaction score
0
First Language
English
Primarily Uses
Edit: I'm using VX ace.

I apologize if this question has been brought up before (I searched for it and was unable to find it) or if I've placed it in the wrong section but I was hoping someone could help me create my first selectable window in rgss.

I'm completely new to scripting but after following various tutorials I think I've got some of the basics of creating a selectable window down, but I can't seem to activate it. The window creates perfectly fine, but the cursor doesn't flash and I can't move it up or down. I was under the impression that I'm supposed to simply activate the window with a "@mywindow.active = true" line but I guess I"m missing something.

Here's what I have so far.

############################################################

## The Selectable Lore Window

Class Window_Lore < Window_Selectable     

   

 def initialize

   super(0, 64, 544, 416-64)

   refresh

 end

 

 def refresh

    create_contents

   for i in 0...$game_party.lore.size

     lore = $game_party.lore

    lorestuff = Textlist_Info::Loreinfo[lore]

    lorewriting = lorestuff[0]

    rect = item_rect(i)

    self.contents.draw_text(rect, lorewriting)

    end

  end

end

 

##The Scene that calls the window

 

class Scene_Lore < Scene_Base

 

def start

  create_contents

end

 

  def create_contents

    @loretitle = Window_LoreTitle.new

    @lorewindow = Window_Lore.new

    @lorewindow.active = true

    @lorewindow.index = 0

  end

  

  def update

    @loretitle.update

    @lorewindow.update

    if @lorewindow.active == true

      update_list

      return

    end

  end

   def update_list

    if Input.trigger?(Input::C)

     #   @lorewindow.active = false

        lore = $game_party.lore[@lorewindow.index]

        loreinfo = Textlist_Info::Loreinfo[lore]

        Sound.play_decision

        @lorepic = Sprite.new

        @lorepic.bitmap = Cache.picture(loreinfo[2])

    end

    if Input.trigger?(Input:: B)

       SceneManager.call(Scene_Save)

    end

  end

 


 def terminate

    @lorewindow.dispose

  end

  

end
 
Last edited by a moderator:

Funplayer

Self proclaimed sponge.
Veteran
Joined
Oct 9, 2013
Messages
120
Reaction score
35
First Language
English
Primarily Uses
You need to set @item_max to be the amount of lore selectable items in your window.  If you examine the code for the Window_Selectable, you'll find the @item_max actually populates the window's cursor counters.  You'll also find it very painful to modify or remove said cursor, without replacing it entirely... but that's another story.

Code:
 def refresh    create_contents    @item_max = $game_party.lore.size    for i in 0...@item_max      lore = $game_party.lore[i]      lorestuff = Textlist_Info::Loreinfo[lore]      lorewriting = lorestuff[0]      rect = item_rect(i)      self.contents.draw_text(rect, lorewriting)    end  endenddef update  superend
 

# You can also activate at window, by using the "@active = true" call when initializing a window, after you have called the super(x,y,width,height).  But keep in mind, this will start the window as a default of active, so this is generally bad practice to do.
 
Last edited by a moderator:

Zansettsu

Villager
Member
Joined
Feb 2, 2015
Messages
6
Reaction score
0
First Language
English
Primarily Uses
Thanks so much for the reply! I've set the item max but I still have the same problem where the window doesn't activate. The cursor doesn't flash and I can't scroll up or down the list neither can I exit out of anything.  I've tried activating it under super as well but it doesn't do anything. 

thanks again!
 

Funplayer

Self proclaimed sponge.
Veteran
Joined
Oct 9, 2013
Messages
120
Reaction score
35
First Language
English
Primarily Uses
Edit:

Okay i see the problem.  Simply set the item number BEFORE you create the contents.  This is the reason its not working.

def refresh self.contents.clear @item_max = $game_party.lore.size create_contents for i in 0...@item_max lore = $game_party.lore lorestuff = Textlist_Info::Loreinfo[lore] lorewriting = lorestuff[0] rect = item_rect(i) self.contents.draw_text(rect, lorewriting) end endShould be the proper fix to make this work.

If you examine the create_contents method, you'll find it creates a rectangular bitmap for the self.contents object within the window.  This bitmap is created and is dictated by the size of the item max, column max, and row max values.  You should also call self.contents.clear, before you create_contents, as this is good for refreshing changes while the script is active.
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You don't have to do anything with 'item_max'.

In the update method of the scene, you did not put 'super' anywhere. That is why, no matter what you do, the window will not update itself at all.

The first line in the update method must be a 'super' if you are creating a new scene class.

That line updates player inputs as well too.

Add that line (and remove the not necessary lines) and your window will get activated without any issue. It should look like this:

Code:
def update    super    if @lorewindow.active == true      update_list    end  end
No need for 'return' commands directly in the update method, just make a condition for your new method, like you already did.
 

Funplayer

Self proclaimed sponge.
Veteran
Joined
Oct 9, 2013
Messages
120
Reaction score
35
First Language
English
Primarily Uses
I forgot it needs a super call.  Yes including the super should fix any sort of scene progression update issues.
 

Zansettsu

Villager
Member
Joined
Feb 2, 2015
Messages
6
Reaction score
0
First Language
English
Primarily Uses
Thanks a lot to the both of you! So I did as you suggested but I realized I had been coding using rpg maker vx's code when I should have been using rgss3. So I tried to learn how to make selectable windows in that to the best of my ability but now I have the opposite problem. The cursor flashes and the ok and cancel methods work fine. It's just that the window doesn't draw any of the selectable options.

Thanks so much for being so patient with a newbie like me. I really appreciate the help. 

Here's what I have now.

##############################################

class Window_LoreTitle < Window_Base

 

 def initialize

  super(0,0, 544, 64)

  create_contents

  refresh

 end

 

 def refresh

 # self.font.size = 24

  self.contents.draw_text(0, 0,544, line_height, "TEXTS")

 end

 

end

 

class Window_Lore < Window_Selectable

   

 def initialize

   super(0, 64, 544, 416-64)

   @active = true

   @data = []

   refresh

 end

 

 

 def item max

   return  $game_party.lore.size

 end

 

  

 def make_item_list

   self.contents.clear

   for i in 0...$game_party.lore.size

    lore = $game_party.lore #array in $game_party

     lorestuff = Textlist_Info::Loreinfo[lore]  #sets lore equal to hash key

      lorewriting = lorestuff[0]  #gets the text string from the hash

      @data.push(lorewriting)

    end

  end 

 

 def draw_item(index)

    item = @data[index]

    rect = item_rect(index)

    rect.width -= 4

     self.contents.draw_text(rect, item)

    end

 

   def refresh

     make_item_list

    create_contents

    draw_all_items

  end

    

end

 

class Scene_Lore < Scene_Base

 

def start

  super

  create_contents

end

 

  def create_contents

    @loretitle = Window_LoreTitle.new

    @lore_window = Window_Lore.new

    @lore_window.set_handler:)ok,     method:)on_lore_ok))

    @lore_window.set_handler:)cancel, method:)return_scene))

    @lore_window.active = true

    @lore_window.index = 0

  end

  

  def on_lore_ok

    Sound.play_use_item

    @lore_window.activate

  end

 

  

end

##################################
 

Funplayer

Self proclaimed sponge.
Veteran
Joined
Oct 9, 2013
Messages
120
Reaction score
35
First Language
English
Primarily Uses
Are you sure the $game_party.lore is being accessed correctly?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You need to define the 'make_command_list' not the 'make_item_list'.

I don't know how is your lore data stored, so I can only guess, but it should look like this:

def make_command_list $game_party.lore.each do |lore| lorestuff = Textlist_Info::Loreinfo[lore] add_command(lorestuff[0], :symbol) end endYou also don't need to touch the refresh method in your Window_Lore selectable window, so delete those lines, unless you want to show something else too and not just the selectable commands.The draw_item method can be discarded as well, it will draw that anyway, so you can delete that.

The item_max depends on the currently available items in the selectable window, so it is not necessary to define that either if you defined the command list right.

I did notice that you are following the same way like how a 'Window_ItemList' would operate.

If those "lores" are items in the inventory, you can simply inherit Window_ItemList instead of Window_Selectable and adjust the 'include?' method, so that it only shows the items you want to show.

It would be much easier to help if we could know what exactly are you trying to do.

Give us a sample of your lore hash and try to explain what you want to do with it.
 

Zansettsu

Villager
Member
Joined
Feb 2, 2015
Messages
6
Reaction score
0
First Language
English
Primarily Uses
Thanks a lot for the help, guys!

You need to define the 'make_command_list' not the 'make_item_list'.

I don't know how is your lore data stored, so I can only guess, but it should look like this:

def make_command_list $game_party.lore.each do |lore| lorestuff = Textlist_Info::Loreinfo[lore] add_command(lorestuff[0], :symbol) end endYou also don't need to touch the refresh method in your Window_Lore selectable window, so delete those lines, unless you want to show something else too and not just the selectable commands.

The draw_item method can be discarded as well, it will draw that anyway, so you can delete that.

The item_max depends on the currently available items in the selectable window, so it is not necessary to define that either if you defined the command list right.

I did notice that you are following the same way like how a 'Window_ItemList' would operate.
If those "lores" are items in the inventory, you can simply inherit Window_ItemList instead of Window_Selectable and adjust the 'include?' method, so that it only shows the items you want to show.

It would be much easier to help if we could know what exactly are you trying to do.
Give us a sample of your lore hash and try to explain what you want to do with it.
Sorry I should have explained my goal earlier. I'm trying to make a simple window that displays little pieces of lore when you select them. When selected they should bring up a picture file associated with the selected lore. However, I didn't want the lore to be items the player picks up  in the inventory. The lore should just be added to the list as they unlock.  Here's my lore module I started. 

#################################################

module Textlist_Info

 

  

  #lorebook id  => Name/file

   Loreinfo = {

     0 => ["The Great Frontier", Greatfrontier.png],

     1 => ["Second Bit of Lore", Secondlore.png],

     3 =>["Third Lore", Thirdlore.png]

   }

   

  

  end

#########################################################################

 

I also added 

attr_accessor :lore

@lore = []

                   to the Game_Party script. This is an array that stores the id's of the lores that the player has unlocked and they correlate to the keys in the above module's hash.

 

And yeah haha, I was using the Window_Itembase to try to figure out how to create a list of options in a window. 

Are you sure the $game_party.lore is being accessed correctly?
No I don't think it is.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
I made a working sample for your lore scene with many comments to explain some things.

I don't know if this is exactly what you want to do or not, but here is how it works:

It will make a command list depending on the unlocked lores.

An image will be displayed in a separate window, and that image will be automatically changed if the cursor's position is changed on the command window.

The image displayed will, of course, be the one tied with the lore settings.

Anyway, here is the little script:

module Textlist_Info # If you want images to be displayed, you must define these images as strings, # and the strings will be the file name of the images used in the scene. # File extensions can be omitted! # So the format of the following setting: # id => ["command button's name","file name of the image"], # I set it up, so the image files must be in the /Graphics/Pictures/ folder # of your game, but you can change that below in the script itself. Loreinfo = { 0 => ["The first","timerbackv1"], 1 => ["The second","timerbackv2"], 3 => ["The fourth","timerbackv3"], 4 => ["The fifth","timerbackv4"], 5 => ["The sixth","timerbackv5"], }endclass Game_Party < Game_Unit attr_accessor :lore # No idea how you added the lore variable, but this is the way to do it. # It must be initialized, so it must be added into the 'initialize' method. # Alias will be your best friend while writing your own scripts. alias sixth_loreini2233 initialize def initialize sixth_loreini2233 @lore = [] end endclass Game_Interpreter # Just a script call for adding lores during the game. # I needed it for testing. # This assumes that 'lore' in the arguments is an array! def add_lore(lore) lore.each do |id| $game_party.lore.push(id) unless $game_party.lore.include?(id) end end endclass Window_LoreTitle < Window_Base def initialize super(0,0, 544, 64) refresh end # draw_text can be called directly in any window, no need for writing # 'self.contents.draw_text' all the time. def refresh contents.clear draw_text(0, 0,contents.width, contents.height, "The Lore Title",1) end end# This will be the "help" window for the lore scene.# This window will display the images directly and will automatically change the# image if the cursor changes in the command window of the scene.class Window_LoreDisplay < Window_Base def initialize super(150,64, 544-150, 416-64) end # 'data' is the extended data of the command buttons, and will contain # the file name of the images for each unlocked lores. # More on this can be found in the command window. def refresh(data) # Always clear the contents before doing anything in refresh methods! contents.clear # This is how we can draw images in windows. # 'pic' will be the image used in the window. # It will use the cache for faster processing. # 'Cache.picture' means that the images must be in the /Graphics/Pictures/ # folder! More reference on this can be found in the Cache module, which can # be found at the top of the script list in the editor. # You can see which folders are available to use by default there. # The 'data' will be the file name of the image, and is gotten from the # command window. pic = Cache.picture(data) # This will create a rectangle for the image. # The below setting keeps the image's original format. rect = Rect.new(0, 0, pic.width, pic.height) # The positioning of the image in the window. # Format: # contents.blt(x,y,image,rect,opacity) # So, this will put the selected image in the top left corner of the window, # the image will keep it's original size, and will be drawn with 255 (max) # opacity, which means it will not be transparent at all. contents.blt(0,0, pic, rect, 255) end endclass Window_Lore < Window_Command def initialize # Window_Command can have only 2 values for the super call, # those are the X and Y positions of the window. # The width and height is instead defined below. super(0, 64) self.active = true end def window_width 150 end def window_height 416-64 end def make_command_list # This will make the command list. # The 'text' will be the text defined in the module for the lore. # The 'data' will be the file name of the image displayed. # The arguments for the 'add_command' call are: # 1st: The displayed name for the command itself, must be a string. # 2nd: The symbol used for the handler. With this, you can make different # command buttons make different things. We don't need that now, so it # can be 'nil', otherwise it must be a symbol. # 3rd: The enable value of the command button. Can be true or false. # 4th: The extended data for the command button. It can be just about anything # you want. Especially useful with handling complax scenes as well as for # updating help windows, which we will do now. # For getting the currently selected command button's symbol or extended data, # we can use 'current_symbol' and 'current_ext' anywhere within the class, as # well as within the scene itself. Extra useful! $game_party.lore.each do |lore| text = Textlist_Info::Loreinfo[lore][0] data = Textlist_Info::Loreinfo[lore][1] add_command(text,nil,true,data) end end # This will update the display of the lore automatically. # The help window for this command window is defined in the scene itself. # 'current_ext' is the file name of the image, the same value we have stored # as 'data' above and passed that data as the 4th argument in the 'add_command' # call. def update_help @help_window.refresh(current_ext) end endclass Scene_Lore < Scene_Base def start super # Don't use "not-so-unique" names for any method, such as "create_contents" # and the like. You can name your methods however you want to, so use your # own, unique names for them to avoid any method name clashing with other # scripts. create_all_stuff end def create_all_stuff @loretitle = Window_LoreTitle.new # This will be the "help" window and will be used to draw the images # associated with the lores. @lore_data = Window_LoreDisplay.new @lore_window = Window_Lore.new # This is how you set a help window for a selectable window. @lore_window.help_window = @lore_data # We don't need any :ok handler now, the image changes automatically upon # changing the cursor's position. #@lore_window.set_handler:)ok, method:)on_lore_ok)) @lore_window.set_handler:)cancel, method:)return_scene)) end # Yeah, we don't need this for now. #~ def on_lore_ok#~ Sound.play_use_item#~ @lore_window.activate#~ end end
I tried to explain everything, but if you have some questions, ask away!

Or if you wanted to show the image only when the player presses the OK button and on the whole game screen, well, you will have to change some things for that, but the available commands in the command window should use the same method anyway, so I guess that problem is solved anyway.

The lores will not be sorted at all with the script call I made for testing, keep that in mind!

You can sort them after the addition with the .sort method on the array. Read the help files for more info about that.

Hope this helps! :)
 

Zansettsu

Villager
Member
Joined
Feb 2, 2015
Messages
6
Reaction score
0
First Language
English
Primarily Uses
I made a working sample for your lore scene with many comments to explain some things.

I don't know if this is exactly what you want to do or not, but here is how it works:

It will make a command list depending on the unlocked lores.

An image will be displayed in a separate window, and that image will be automatically changed if the cursor's position is changed on the command window.

The image displayed will, of course, be the one tied with the lore settings.

Anyway, here is the little script:

module Textlist_Info # If you want images to be displayed, you must define these images as strings, # and the strings will be the file name of the images used in the scene. # File extensions can be omitted! # So the format of the following setting: # id => ["command button's name","file name of the image"], # I set it up, so the image files must be in the /Graphics/Pictures/ folder # of your game, but you can change that below in the script itself. Loreinfo = { 0 => ["The first","timerbackv1"], 1 => ["The second","timerbackv2"], 3 => ["The fourth","timerbackv3"], 4 => ["The fifth","timerbackv4"], 5 => ["The sixth","timerbackv5"], }endclass Game_Party < Game_Unit attr_accessor :lore # No idea how you added the lore variable, but this is the way to do it. # It must be initialized, so it must be added into the 'initialize' method. # Alias will be your best friend while writing your own scripts. alias sixth_loreini2233 initialize def initialize sixth_loreini2233 @lore = [] end endclass Game_Interpreter # Just a script call for adding lores during the game. # I needed it for testing. # This assumes that 'lore' in the arguments is an array! def add_lore(lore) lore.each do |id| $game_party.lore.push(id) unless $game_party.lore.include?(id) end end endclass Window_LoreTitle < Window_Base def initialize super(0,0, 544, 64) refresh end # draw_text can be called directly in any window, no need for writing # 'self.contents.draw_text' all the time. def refresh contents.clear draw_text(0, 0,contents.width, contents.height, "The Lore Title",1) end end# This will be the "help" window for the lore scene.# This window will display the images directly and will automatically change the# image if the cursor changes in the command window of the scene.class Window_LoreDisplay < Window_Base def initialize super(150,64, 544-150, 416-64) end # 'data' is the extended data of the command buttons, and will contain # the file name of the images for each unlocked lores. # More on this can be found in the command window. def refresh(data) # Always clear the contents before doing anything in refresh methods! contents.clear # This is how we can draw images in windows. # 'pic' will be the image used in the window. # It will use the cache for faster processing. # 'Cache.picture' means that the images must be in the /Graphics/Pictures/ # folder! More reference on this can be found in the Cache module, which can # be found at the top of the script list in the editor. # You can see which folders are available to use by default there. # The 'data' will be the file name of the image, and is gotten from the # command window. pic = Cache.picture(data) # This will create a rectangle for the image. # The below setting keeps the image's original format. rect = Rect.new(0, 0, pic.width, pic.height) # The positioning of the image in the window. # Format: # contents.blt(x,y,image,rect,opacity) # So, this will put the selected image in the top left corner of the window, # the image will keep it's original size, and will be drawn with 255 (max) # opacity, which means it will not be transparent at all. contents.blt(0,0, pic, rect, 255) end endclass Window_Lore < Window_Command def initialize # Window_Command can have only 2 values for the super call, # those are the X and Y positions of the window. # The width and height is instead defined below. super(0, 64) self.active = true end def window_width 150 end def window_height 416-64 end def make_command_list # This will make the command list. # The 'text' will be the text defined in the module for the lore. # The 'data' will be the file name of the image displayed. # The arguments for the 'add_command' call are: # 1st: The displayed name for the command itself, must be a string. # 2nd: The symbol used for the handler. With this, you can make different # command buttons make different things. We don't need that now, so it # can be 'nil', otherwise it must be a symbol. # 3rd: The enable value of the command button. Can be true or false. # 4th: The extended data for the command button. It can be just about anything # you want. Especially useful with handling complax scenes as well as for # updating help windows, which we will do now. # For getting the currently selected command button's symbol or extended data, # we can use 'current_symbol' and 'current_ext' anywhere within the class, as # well as within the scene itself. Extra useful! $game_party.lore.each do |lore| text = Textlist_Info::Loreinfo[lore][0] data = Textlist_Info::Loreinfo[lore][1] add_command(text,nil,true,data) end end # This will update the display of the lore automatically. # The help window for this command window is defined in the scene itself. # 'current_ext' is the file name of the image, the same value we have stored # as 'data' above and passed that data as the 4th argument in the 'add_command' # call. def update_help @help_window.refresh(current_ext) end endclass Scene_Lore < Scene_Base def start super # Don't use "not-so-unique" names for any method, such as "create_contents" # and the like. You can name your methods however you want to, so use your # own, unique names for them to avoid any method name clashing with other # scripts. create_all_stuff end def create_all_stuff @loretitle = Window_LoreTitle.new # This will be the "help" window and will be used to draw the images # associated with the lores. @lore_data = Window_LoreDisplay.new @lore_window = Window_Lore.new # This is how you set a help window for a selectable window. @lore_window.help_window = @lore_data # We don't need any :ok handler now, the image changes automatically upon # changing the cursor's position. #@lore_window.set_handler:)ok, method:)on_lore_ok)) @lore_window.set_handler:)cancel, method:)return_scene)) end # Yeah, we don't need this for now. #~ def on_lore_ok#~ Sound.play_use_item#~ @lore_window.activate#~ end end
I tried to explain everything, but if you have some questions, ask away!

Or if you wanted to show the image only when the player presses the OK button and on the whole game screen, well, you will have to change some things for that, but the available commands in the command window should use the same method anyway, so I guess that problem is solved anyway.

The lores will not be sorted at all with the script call I made for testing, keep that in mind!

You can sort them after the addition with the .sort method on the array. Read the help files for more info about that.

Hope this helps! :)
Thanks so much for your help! It works perfectly now, and I've learned a lot about how to make command windows. And I was able to get it to show two pages for certain lore. Anyways thanks a lot! As for questions, I just wanted to know if it's possible to have two help windows per one selectable window. Thanks again!

Edit: Oh and your explanations helped a ton!
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You might want to put block of code into code tags so they're formatted correctly (look over your posts and see how the forum has changed some of the code into smilies!)


And for large blocks of code, put the lot into spoiler tags so it doesn't take up so much space.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
By default, only one help window is coded for each selectable window.

Multiple help windows can be coded in for sure, but I haven't tried it yet.

If you want to add more help windows, take a look at how the default help window is assigned and handled in Window_Selectable. Search for the 'def help_window=(help_window)' method and follow it through the method calls.

You can mimic that to create more help windows, in theory.

You can also simply make more "help windows" in the scene class itself by playing with the update method.

Add your own update method into the 'update' method, make a condition for it and do your stuff inside the condition, like refreshing the 2nd help window when the cursor changes in the selectable window.

You absolutely must give a condition to every update method you make or else the method will be called constantly and that will kill the FPS on the scene, keep this in mind!

A basic update method would be something like this:

def update_the_2nd_help_win @old_index = -1 if @old_index.nil? if @old_index != @command_window.index @help_win2.refresh(@command_window.index) @old_index = @command_window.index endendSo it calls the refresh for the 2nd help window only when the cursor changes and only once.Passing the command window's current index as an argument for the refresh method of the help window will let you make different things happen in the 2nd help window depending on the selected command, effectively making this window act like the real help windows.

This is how I usually do stuff if I need more than one windows to be updated when something changes in a command window.
 

Zansettsu

Villager
Member
Joined
Feb 2, 2015
Messages
6
Reaction score
0
First Language
English
Primarily Uses
You might want to put block of code into code tags so they're formatted correctly (look over your posts and see how the forum has changed some of the code into smilies!)

And for large blocks of code, put the lot into spoiler tags so it doesn't take up so much space.
Sorry about that. I'll be sure to do that in the future.

By default, only one help window is coded for each selectable window.

Multiple help windows can be coded in for sure, but I haven't tried it yet.

If you want to add more help windows, take a look at how the default help window is assigned and handled in Window_Selectable. Search for the 'def help_window=(help_window)' method and follow it through the method calls.

You can mimic that to create more help windows, in theory.

You can also simply make more "help windows" in the scene class itself by playing with the update method.

Add your own update method into the 'update' method, make a condition for it and do your stuff inside the condition, like refreshing the 2nd help window when the cursor changes in the selectable window.

You absolutely must give a condition to every update method you make or else the method will be called constantly and that will kill the FPS on the scene, keep this in mind!

A basic update method would be something like this:

def update_the_2nd_help_win @old_index = -1 if @old_index.nil? if @old_index != @command_window.index @help_win2.refresh(@command_window.index) @old_index = @command_window.index endendSo it calls the refresh for the 2nd help window only when the cursor changes and only once.Passing the command window's current index as an argument for the refresh method of the help window will let you make different things happen in the 2nd help window depending on the selected command, effectively making this window act like the real help windows.

This is how I usually do stuff if I need more than one windows to be updated when something changes in a command window.
Sorry for the late reply but thanks so much for your help! You've helped me understand a ton! Thanks to you, I was able to make a (admittedly crude for now) quest system as well as the lore system I posted about here. Thanks again!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top