Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: johanvepa on Sun 13/12/2015 20:38:08

Title: [SOLVED] Interacting with inventory items
Post by: johanvepa on Sun 13/12/2015 20:38:08
There's a lot of things I dont understand about the inventory window.

I am trying to create a game with a perpetually open inventory GUI on the right side of the screen. I plan for the user to select items from the inventory window, then use items directly onto the game screen without opening and closing the inventory GUI.

My default cursor is eModeInteract since there will be no walking around in this game.

I can select an inventory item with the mouse cursor, and the cursor changes into the mouse cursor graphic of that inventory item. I can then use said inventory item on hotspots and objects as usual.

But, I also want other things to happen when I click on the inventory items with the eModeInteract mouse cursor.
This is where it gets strange. Even though I script for something to happen when interacting with inventory item, it doesn't. At the event handle panel for a given inventory item, like my iAcorn, I put something in the global script to happen for the event of "Interact inventory item" (and yes, I have remembered to use the event control panel of the item as well). When clicking the mouse cursor (in eModeInteract) at the image of iAcorn on the inventory window, the cursor changes to the CursorImage of iAcorn, but nothing else I scripted happens.
I dont understand why not?

Also, if I make a default cursor graphic for eModeUseinv, the cursor hotspot insists on being at 0,0 instead of the cursor hotspot coordinates I give it. Why wont the cursor hotspot obey?

And yet another thing: For experimenting, I put something in the item's event panel to happen when player should "Look at inventory item". Now, if I right-click on the inventory item, the designated stuff to happen for "look" happens, even though I am not using the eModeLookat cursor and there is not even anything scripted to happen for right-clicks in my game (I am using the blank game template and have nothing scripted for any right-clicks). Yet right-click makes the player look at the inventory item. Huh?

I understand nothing. Me no unnerstand.

I consider re-writing an inventory GUI from scratch using buttons and such, but its timeconsuming. I'd much rather understand why the inventory window doesnt act the way I would expect?
Title: Re: Interacting with inventory items
Post by: Crimson Wizard on Sun 13/12/2015 20:46:13
First thing to check is whether "Override built-in inventory window click handling" option is enabled in General Settings.
If that won't solve all problems, what is written in your on_mouse_click function regarding inventory?
Title: Re: Interacting with inventory items
Post by: johanvepa on Sun 13/12/2015 20:49:36
Quote from: Crimson Wizardwhat is written in your on_mouse_click function regarding inventory?
Nothing about inventory. Maybe there should be?
I'll try out that other thing you pointed out.
Title: Re: Interacting with inventory items
Post by: johanvepa on Sun 13/12/2015 20:59:14
To be more precise, in my on_mouse_click function I have:
    ProcessClick(mouse.x,mouse.y, mouse.Mode);

I tried setting "Override built-in inventory window click handling" to TRUE.
Now the mouse cursor doesn't change into that of the item's cursor graphic, but other events from the item's event handle panel doesn't happen anyway.
Title: Re: Interacting with inventory items
Post by: Khris on Sun 13/12/2015 22:37:35
For folks who happen upon this thread via the forum search: full explanation here (http://www.adventuregamestudio.co.uk/forums/index.php?topic=53002.msg636526968#msg636526968)