Inventory scroll buttons (visible/invisible)

Started by sloppy, Tue 28/02/2006 16:07:25

Previous topic - Next topic

sloppy

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?

Ashen

InvWindow.ItemCount property. (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.
I know what you're thinking ... Don't think that.

sloppy

#2
Thank you!


sloppy

One more thing.  This works perfectly in the repeatedly_execute:
Code: ags

 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:
Code: ags

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.

SMF spam blocked by CleanTalk