Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: pslim on Wed 26/07/2006 05:22:55

Title: Custom Inv Problems--Changing Item Height/Width on the fly [SOLVED]
Post by: pslim on Wed 26/07/2006 05:22:55
Hey.

My PC has two inventories, which appear in the same inventory box, but at different times (handled when the player clicks the buttons associated with each set of items). The item categories are not anywhere near the same sizes, so I need to have two separate item height/width designations, imposed by clicking the same buttons on the icon bar.

I tried setting the ItemHeight and ItemWidth properties within the code that's performed as a result of the player clicking on the buttons to bring up the inventory window, but that seems to do very strange things like not show any items in one inventory set and only showing one in the other.

The code associated with the two buttons is as follows:

function btnIconInv_Click(GUIControl *control, MouseButton button) {
Ã, 

Ã,  CopyInventory(1, 12); //copy inventory
Ã,  UpdateInventory();
Ã,  invCustomInv.Height = 25;
Ã,  invCustomInv.Width = 30;
Ã,  gui[2].Visible = true; //open inventory
Ã,  mouse.Mode = eModeInteract;
Ã,  mouse.UseModeGraphic(eModePointer);
Ã,  gIconbar.Visible = false;

}


The other one is identical, with the exception of having different variables called in CopyInventory();.

In the GUI editor I have the size of invCustomInv as 211x127 and item size as 120x18 (the size of the other set of inventory items).

If I take out the height/width code and just use the settings in the GUI editor, everything works. I'm confused.Ã,  :=

Title: Re: Custom Inv Problems--Changing Item Height/Width on the fly
Post by: Gilbert on Wed 26/07/2006 06:13:05
Maybe you can try moving the UpdateInventory(); line below the width/height codes and above the gui visible line?
Title: Re: Custom Inv Problems--Changing Item Height/Width on the fly
Post by: SSH on Wed 26/07/2006 08:18:57
It might be easier to actually use two different GUIs and turn one of them off at any one time...
Title: Re: Custom Inv Problems--Changing Item Height/Width on the fly
Post by: pslim on Wed 26/07/2006 09:50:12
Quote from: Gilbot V7000a on Wed 26/07/2006 06:13:05
Maybe you can try moving the UpdateInventory(); line below the width/height codes and above the gui visible line?

I thought that was a good idea, but it didn't work. :/

I think SSH may be right, but I'm going to hold out a little longer and see if anyone has any idea why it's behaving the way it is before I give up completely and just make another inventory window.
Title: Re: Custom Inv Problems--Changing Item Height/Width on the fly
Post by: SSH on Wed 26/07/2006 10:04:12
I notice in your code that you're changing invCustomInv.Height and invCustomInv.Width... don't you mean invCustomInv.ItemWidth and invCustomInv.ItemHeight?

Title: Re: Custom Inv Problems--Changing Item Height/Width on the fly
Post by: pslim on Wed 26/07/2006 11:56:12
Quote from: SSH on Wed 26/07/2006 10:04:12
I notice in your code that you're changing invCustomInv.Height and invCustomInv.Width... don't you mean invCustomInv.ItemWidth and invCustomInv.ItemHeight?


Arrrgh.  :-[ 

You're right, of course. Thanks, SSH.