Adding the 5th Item to the inventory creates a empty 2nd inventory row

Started by Marcel86, Tue 17/11/2020 21:40:16

Previous topic - Next topic

Marcel86

I am using AGS 3.5.0 and the Tumbleweed template and are struggeling with a problem related to the invetory slots.
The template has a 4x2 Grid for items.

As long as I am not adding more than 4 inventory items to the inventory, everything is fine. The items are lined up
in the first row, starting from the left to the right.
However when I add the 5th item with player.AddInventory, the 5th item is not added to the second empty row as expected.
Instead its added to the third row which is only accessable by scrolling.

So in the end, I have:   Row 1: 4 items, Row 2: 0 items, Row 3: 1 item.

Any idea what's wrong or where I can changed that behaviour so that the item is added correctly to the empty row 2 instead of row 3?

Thank you for your help!

Marcel86

Was able to solve it myself.

After some digging in the manuals, it seems that AGS is actually calculating based on the height of the GUI bg and the inventory thumbnail height, if the item is added to the second line or not.

QuoteRowCount property (inv window)

readonly int InvWindow.RowCount;

Gets the number of rows that can be displayed within the inventory window. This is calculated by dividing the height of the window by the individual ItemHeight.

Example:

Display("The inventory window can show %d items at a time", invMain.ItemsPerRow * invMain.RowCount);

displays how many items can be visible in the invMain window at once.

See Also: InvWindow.ItemHeight, InvWindow.ItemsPerRow

The height of my item thumbnails was 21, the height of the GUIControl Object 41.   41 / 31 < 2 so, only one Row was filled.

A good example to make simple things extremely complicated, but at least I know the trick now ;-)

SMF spam blocked by CleanTalk