Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sloppy on Tue 28/02/2006 16:07:25

Title: Inventory scroll buttons (visible/invisible)
Post by: sloppy on Tue 28/02/2006 16:07:25
Does anyone know how to script the inventory GUI so that the up/down scroll buttons only appear when they're neccessary?  I'm not looking for anything fancy - there's only room for a row of 3 objects in the inventory box, and if there's more the scroll buttons would appear.

Where would that scripting take place?
Title: Re: Inventory scroll buttons (visible/invisible)
Post by: Ashen on Tue 28/02/2006 17:38:40
InvWindow.ItemCount property (http://www.adventuregamestudio.co.uk/manual/InvWindow.ItemCount.htm). (Although I think the line btnInvDown.Enabled = false; should be = true;.)

Where to put it depends on what type of inventory you have. If it turns on and off, put the code wherever you turn it on. If it's always on, repeatedly_execute is probably the best bet.
Title: Re: Inventory scroll buttons (visible/invisible)
Post by: sloppy on Tue 28/02/2006 17:50:18
Thank you!

Title: Re: Inventory scroll buttons (visible/invisible)
Post by: sloppy on Wed 01/03/2006 05:35:29
One more thing.  This works perfectly in the repeatedly_execute:

if (inven.ItemCount>(inven.ItemsPerRow * inven.RowCount)) {
    down.Visible=true;
    up.Visible=true;
    }


But I also want the arrows to disappear when they're not needed.  I thought this would do it:

if (inven.ItemCount<(inven.ItemsPerRow * inven.RowCount)) {
    down.Visible=false;
    up.Visible=false;
    }

But when the inventory empties down to 1 or 2 items, the arrows are still there.