Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: bx83 on Mon 23/03/2020 19:50:41

Title: How do you dig the script name (ie. iKey) out of an inventoryitem?
Post by: bx83 on Mon 23/03/2020 19:50:41
Here's the deal: I want to get the script-referenced name 'iKey'
However, when I go:

String item_Name=inventory[125].Name;

It simply produces 'A Magical Key' rather than 'iKey'

I've tried GetTextProperty("Description"), and etc, and nothing works and/or just produces 'A Magical Key'

I've had a look at Kris' comment in https://www.adventuregamestudio.co.uk/forums/index.php?topic=49878.0 , but it's confusing me (and my easily-confused brain) even more.

So question stands: how do I get 'iKey'?
Title: Re: How do you dig the script name (ie. iKey) out of an inventoryitem?
Post by: Crimson Wizard on Mon 23/03/2020 20:06:04
You cannot do that directly at the moment, as it is not exposed to the script API.

As a workaround, you may either use custom properties, or create a global array of strings in script and fill it with these names (may be faster to accomplish).

Quote from: bx83 on Mon 23/03/2020 19:50:41
I've tried GetTextProperty("Description"), and etc, and nothing works and/or just produces 'A Magical Key'

GetTextProperty returns a custom property, that has to be created and value set by you first.
Title: Re: How do you dig the script name (ie. iKey) out of an inventoryitem?
Post by: Khris on Tue 24/03/2020 09:34:27
This sounds like an XY problem (http://xyproblem.info/) to me, can you tell us what you're trying to achieve?