[ACE] Help with this window... contents not scrolling

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
Hello everyone, i made a window wich will draw every character present in $data_actor in a somewhat choose your starting party system. So this window, it draws the actor characters until it reaches maximum height and then it don't scroll to show the other characters. Here are some screens of what is happening instead:



If you want to test it yourself, i made a example scene, just call SceneManager.call(Scene_PartySelect) and you'll see. here's my code:



Code:
class Window_CharList < Window_Selectable
  def initialize(x,y)
    super(x, y, 70, Graphics.height - y)
    @itens = []
    make_item_list
    select(0)
    activate
    refresh
  end
  def item_max
    @itens ? @itens.size : 1
  end
  def item
    @itens && index >= 0 ? @itens[index] : nil
  end
  def item_rect(index)
    rect = Rect.new
    rect.width = 38
    rect.height = 38
    rect.x = 4
    rect.y = index * rect.height
    rect
  end
  def make_item_list
    for i in 1...$data_actors.size
	  @itens[i - 1] = $game_actors[i]
    end
  end
  def draw_item(index)
    item = @itens[index]
    if item
	  rect = item_rect(index)
	  draw_actor_graphic(item, 22, rect.y + 36)
    end
  end
  def refresh
    contents.clear
    for i in 0...@itens.size
	  draw_item(i)
    end
  end
end

class Scene_PartySelect < Scene_MenuBase
  def start
    super
    create_all_windows
  end
  def create_all_windows
    @charlist_window = Window_CharLista.new(0,0)
    @charlist_window.set_handler(:cancel,    method(:return_scene))
  end
end
I don't know how to fix it, and neither if i was clear enough with my bad english, but if someone could fix it and/or tell me what i did wrong i'll be glad. Thanks in advice.
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
It's because the size of the contents bitmap is not correct. It may or may not fix it to add the following to the Window_CharList class.



Code:
def contents_height
  item_max * 38
end
If not, you may need to add "create_contents" where you have "contents.clear" in addition to this.
 
Last edited by a moderator:

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
Thanks, now ithe window shows every character graphic but it still doesn't scroll. The rector goes out of screen while the window shows the same characters.
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
Code:
def item_height
  return 38
end
Add that the same place. Should do the trick now?
 

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
Yes, it did! are thos methods inside the superclass Window_Selectable or Window_Base? Maybe i was blind thinking with was something within my code and not missing other funcionts...

Anyway, thanks!
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
item_height is defined in window_selectable and just returns line height by default. content_height is first defined in window_base but is overwritten by window_selectable. Actually, you can remove the overwrite I gave you because it will work just fine with the change to item_height. I've had this issue with the contents size before, so I kinda knew what was wrong right away.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
contents_height uses line_height in its calculations right
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
contents_height uses line_height in its calculations right
Nope. contents_height does not directly use line_height ever in it's formula. In Window_Base it is "height - standard_padding * 2", which is pretty much all of the window except the edges. Window_Selectable redefines it as "[super - super % item_height, row_max * item_height].max", which pretty much makes it only big enough for all the items the window holds, though Window_Selectable defines item_height as line_height by default (which is the problem that was occurring here). Window_HorzCommand and redefines it as "item_height" since all commands are arranged horizontally and there is no need to any more vertical space and Window_ChoiceList makes it "item_max * item_height" which is similar to how Window_Selectable defines it, but this one assumes all items will be arranged vertically. Each more or less holds objects in it's own way. With how it works, this window probably could have better been a child of Window_ChoiceList, however I personally prefer just using Window_Selectable in a case like this as well. RGSS3 is still a little annoying to me....
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
That's strange then, because contents_height is the height of the bitmap that holds the items drawn on the window.

Or, maybe item_height is used to draw the selection rectangle and offset is accordingly.

But then that doesn't explain why you only need to specify the item_height and ignore the content_height.
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
The window class he's using uses "item_height" in the calculation for "content_height", so there's no need to alter "content_height" as long as he's defined how tall the items are in "item_height".
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
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'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top