I have a button that displays an inventory item in my custom inventory. I don't have an inventory window but instead I have buttons in place of where the inventory items should be placed.Its really hard to explain so i'll try explaining with pictures.
I have a button for interactions.
(https://i.imgur.com/A1DSuzu.jpg)
and an inventory item for receiving the actions as events.
(https://i.imgur.com/4xF5HFM.jpg)
I want the inventory item to recognize events
from the buttons interactions.(As if The inv-item was clicked instead of the object)
(https://i.imgur.com/4zSFr7V.jpg)
if ikey(the button) has an item used on it then ikey2(inv-item) should recognize it as (https://i.imgur.com/BzgF2er.jpg).
And so on with the other events.
I hope I explained it clear enough.
Thanks in advance.
I cannot understand which type of AGS struct ikey is. Is it an object, a button or an inventory item?
If it's an inventory item, you can call it's interaction using RunInteraction
ikey.RunInteraction(eModeInteract);
You can use
if (mouse.Mode == eModeUseinv) { ... }
Oops! I called the button an object. ikey is a button and ikey2 is an inventory item. Will try that Khris when I get a chance. Although something about that doesn't sound right for a button .I could be wrong.
How do I get the global inventory item ("item") to equal the selected inventory item.
I added this to the basic function do_inventory_action(MouseButton button, InventoryItem* item)
Object *o = Object.GetAtScreenXY(mouse.x, mouse.y);
if (o != null && o.GetProperty("inventory")==true)
{
mouse.Mode=eMouseLeftInv;
}
Sorry if my explanation is fragmented and confusing.
eMouseLeftInv is a click type, not a mouse mode.
If you want to set the key as active cursor after clicking the button, you can do
player.ActiveInventory = ikey2;
This should also change the mouse mode to eModeUseinv.
I think I am almost understanding... Are you making a room that works like an inventory, with objects being the things the player added to the inventory?
Its with buttons being the things the player added to the inventory.Its definitely figured out by now. Thanks for your help both of you.