Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Arcangelo Bonaparte on Sat 07/01/2017 13:17:31

Title: Inventory Gui doesn't work. No inventory action possible.
Post by: Arcangelo Bonaparte on Sat 07/01/2017 13:17:31
When I left Click on my inventory GUI the item doesn't get picked up. I get no reaction at all.
Can someone please help me?

The code I used is:

Code (ags) Select
if (button == eMouseLeftInv) {if (character[GetPlayerCharacter()].activeinv==-1){SetCursorMode(4); SetMouseCursor(GetCursorMode());SetActiveInventory(game.inv_activated);}
                                                                           else {RunInventoryInteraction(game.inv_activated, GetCursorMode());SetCursorMode(0);}}
Title: Re: Inventory Gui doesn't work. No inventory action possible.
Post by: Crimson Wizard on Sat 07/01/2017 13:28:36
First of all, make sure the "Override built-in inventory window click handling" option is enabled in General Settings.



On a side note, I noticed that you are using lots of obsolete functions. Are you restoring some old script, or were watching a very old tutorial?
I may not know something about your intentions, but if you are working in latest version of AGS I recommend use code like:
Code (ags) Select

if (button == eMouseLeftInv)
{
    if (player.ActiveInventory == null)
    {
        Mouse.Mode = eModeUseinv;
        player.ActiveInventory = inventory[game.inv_activated];
    }
    else
    {
        player.ActiveInventory.RunInteraction(Mouse.Mode);
        Mouse.Mode = eModeWalkTo;
    }
}