My inventory items are not displayed in the default gInventory (1920x1080 game)

Started by qinzha, Tue 25/02/2025 14:30:13

Previous topic - Next topic

qinzha

Quote from: Crimson Wizard on Wed 26/02/2025 17:26:17
Quote from: qinzha on Wed 26/02/2025 16:57:47Ok where am I supposed to paste the code? Because if I paste it into the globals script and try to call it in the first room, it gives me the following error:

How to export global functions to the room scripts:
https://adventuregamestudio.github.io/ags-manual/ImportingFunctionsAndVariables.html

In this case following line has to be added to GlobalScript header:
Code: ags
import function TransferInventoryTo(this Character*, Character* other);

Omg that works thank you!
But for some reason I can't interact with any of the objects inside and as soon as I close the inventory I also cannot move or interact with anything anymore :S

Khris

Afaik, the VerbCoin template doesn't show the VerbCoin when you click an inventory item. You're basically only supposed to select (left click) / look at (right click) inv items.

The second issue is caused by the Escape key click handling: in line 389, replace gInventory.Visible = false; with
Code: ags
  close_gui(gInventory);
This function also calls VerbCoin.Enable();

qinzha

Thank you, the inventory closes properly now!^^ But I still can't pick any item from my inventory. When I leftclick, nothing happens (normally the item should stick to my cursor from then, right?) :S

Khris

I checked it again and disabling the VerbCoin means inventory clicks are ignored.
So you need to roll back the previous change and also show the inv GUI using
Code: ags
  gInventory.Visible = true;
in your bag button's OnClick handler.

Looks like the open_gui/close_gui functions are supposed to be used for "meta" GUIs like game menus only.

(Also note that your inventory GUI background has spaces in between slots, so you need to increase the invWindow's itemWidth and itemHeight accordingly.)


SMF spam blocked by CleanTalk