Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: elalegreroger on Thu 04/03/2021 18:43:15

Title: Need help: Automatic scroll down when inventory item added
Post by: elalegreroger on Thu 04/03/2021 18:43:15
Hello everyone!

I've a problem trying to show the last item picked up  in the Inventory Windows 'cause every time the "item" is added at the end on the list.  Is there any way to make an automatic scroll down when this last inventory item added? Sorry about my english and greetings from Argentina.
Title: Re: Need help: Automatic scroll down when inventory item added
Post by: arj0n on Fri 05/03/2021 08:49:36
Add something like this after adding an inv item to the players invbox:

Code (ags) Select

int i;
do
{
  invMain.ScrollDown();
  i++
}
while (i < invMain.RowCount);


(invMain is the inv window within the inv GUI)
Title: Re: Need help: Automatic scroll down when inventory item added
Post by: Matti on Fri 05/03/2021 09:40:23
You can create an event in the on_event function in the Global script and put the code there.

Code (ags) Select
function on_event(EventType event, int data)
{
  if (event == eEventAddInventory) {
    // Code
  }
}
Title: Re: Need help: Automatic scroll down when inventory item added
Post by: arj0n on Fri 05/03/2021 09:51:48
Even better :)
Title: Re: Need help: Automatic scroll down when inventory item added
Post by: elalegreroger on Fri 05/03/2021 23:58:51
Thank you so much!!!!!! I'll try to make it work.