Is it possible to globally store an arbitrary/different number of strings for each inventory item? For instance,
InventoryItemA (has associated strings) stringA1, stringA2, ..., stringAx ;
InventoryItemB (has associated strings) stringB1, stringB2, ..., stringBy
and then at a later point, for one item only, search through all its associated strings for a matching .Contains condition, and return that string?
You can make an array of strings, but why do you need to have them as multiple strings for each item, wouldn't it be easier to search just one string?
Currently, I am searching one string. Each of my items have one string property, which consist of searchable substrings separated by delimiters. But my understanding is that a single string can only be 200 characters long (?) and if the string gets too long... I'm looking for a workaround.
The situation this is for is generating custom messages when a specific inventory/mouse cursor is moved over (not clicked on) specific characters, objects or other inventory items. The target, say, a character, has a special value property (X), and if (X) matches one of the strings associated with the item, that string helps generate a custom message such as "Pour water on Bob", whereas any other item would generate a default message such as "Give basket to Bob".
Since AGS 2.71, Strings (with a capital S) can be any length at all. strings with a small s can be only 200 chars, but then you can't make arrays out of them either.
Ahh, then I am confused over the nature of Strings vs. strings.
So, if my inventory item has a custom string property called Verylongstring, can I store more than 200 characters in it? And if I tried to search through it with the following code, would stringToSearch have a limit problem?
String stringToSearch = player.ActiveInventory.GetTextProperty("Verylongstring");
int searchVerylongstring = stringToSearch.Contains("something");
[bold]Update:[/bold]
After some experimentation, strings stored in custom properties on items have the 200-character limit. But strings stored in arrays don't, so I can store the very long strings in those!
First I'd like to say that the BBcode for "bold" is "[ b ]" (without the quotations or spaces). ;)
And secondly, here I go whoring my modules once again! :o
I think you may find that the Properties (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=27385.0) module might offer some assistance in providing what you need.
If that's not quite what you want, then you may want to look at the StringVector (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=27439) module...that will allow you to keep your game file smaller if you need a lot of String arrays because it really just stores it all into one String. If you use String arrays you have to manually define the size of the array, and that also means that memory is allocated for that many Strings even if you don't use that many.
Or you could just do-it-yourself. Whatever works best for you.