You should be able to lose the key_in_shirt variable altogether since AGS has it's own variables for inventory items. This should work too:
Code: ags
Where in InventoryQuanity[1] the 1 means the inventory item number. You can also use the iKEY instead of a number if you like.
// script for Inventory item 5 (shirt): Look at inventory item
if (player.InventoryQuantity[1] == 1) {
player.Say("Yuuck I hate green color.");
player.Say("Hey there's something in a pocket.");
player.AddInventory(iKEY);
player.Say("It's a key!");
}
else player.Say("There's nothing more in a pocket.");
}
Where in InventoryQuanity[1] the 1 means the inventory item number. You can also use the iKEY instead of a number if you like.