Scrolling automatically to top or bottom of inventory icons

Started by bx83, Thu 01/06/2017 08:46:59

Previous topic - Next topic

bx83

Hi

I'm trying to see if there a way to:
-instantly scroll to the bottom of inventory icons, each time the window is displayed; OR
-reverse the order of inventory icons, so that new ones appear at the top of the list

This would have to happen automatically; it would show the recently added objects, each time you open the inventory.

dayowlron

You can put in an index of where to add the inventory and if you pass in 0 it will add it at the beginning of the list.

Code: ags

    cEgo.AddInventory(iKey,0);
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

bx83

But what about an inventory item that's already at 0? It get's bumped to 1?

Snarky

These questions are answered in fairly obvious places in the manual. For example, under "Scripting|Character functions and properties|AddInventory", it says "The new item is inserted before the current item at addAtIndex." So yes, it bumps all the items after it up one position.

As for instantly scrolling to the bottom of the inventory window, if you look under "Scripting|GUI InvWindow functions and properties" you'll see an entry for "TopItem property", which controls the scroll position of the inventory window. If you set it to gYourInventoryWindowName.TopItem - 1 it will only show the very last inventory item. If you want to show more, subtract a larger number (e.g. gYourInventoryWindowName.ItemsPerRow), making sure that it doesn't go below 0 if you only have a few inventory items.

SMF spam blocked by CleanTalk