Which inventory has been clicked on?

Started by Slasher, Fri 11/08/2017 12:18:13

Previous topic - Next topic

Slasher

Hi,

my question is this:

Adding which inventory has been clicked on when combining inventory items. Player Says the line (which is a Random 'Say' variable).

Already have:

Code: ags
 
 player.SayAt(26, 0, 270,String.Format("To my knowledge %s and %s do not mix.",player.ActiveInventory.Name, inventory.Name));
// rather than just using ID: inventory[6]


Help appreciated

Cheers



dayowlron

not able to test this but this should work. Where are you putting this call? on_mouse_click?
Code: ags

InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
player.SayAt(26, 0, 270,String.Format("To my knowledge %s and %s do not mix.",player.ActiveInventory.Name, item.Name));
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Slasher


Khris

You can also use
Code: ags
  InventoryItem *item = inventory[game.inv_activated];

Slasher


dayowlron

Khris, Wouldn't that give him the inventory item that has been activated and not the one clicked on?
inventory[game.inv_activated] is equivalent to player.ActiveInventory.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

monkey0506

Quote from: dayowlron on Mon 21/08/2017 11:35:10inventory[game.inv_activated] is equivalent to player.ActiveInventory.

No, it isn't. The names might be confusingly similar, but they are not intrinsically the same value.

Quote from: The Manualâ,,¢game.inv_activated   Inventory item that the player last clicked on. Useful for unhandled_event.

SMF spam blocked by CleanTalk