Hi, I'm rewriting the way my text game works, so all the data is catalogued in scripts rather than defined in individual rooms. I already know something like the following is possible:
quest[1].log[4] = "You spoke to Lord Woodfoot, who made it clear the gnomes will come to feast at Meyrnost if their vegan lifestyle is catered for.";
Each location can have items in it, so I would like to take the above a step further by doing something like the following:
loc[2].name = "Meyrnost Athenium";
loc[2].item[1].name = "Borromdock";
loc[2].item[1].desc = "A sweet smelling plant.";
loc[2].item[1].pickup = true;
Is this possible? I want to have the room items in a sub-class of the location (loc) class.
Unfortunately not, structs can't have structs as members.
The only alternative is:
item[i(2, 1)].name = "Bottomdock";
where i(int loc, int item) will turn the parameters into an index. Say there are less than 100 items per location, then i would simply return loc*100+item.
Are you familiar with multidimensional array indexing techniques for AGS? The basic idea (for a 2D array) is:
For a multidimensional array:
int array[A][B];
And:
... array[a][b] ...
Your index would be:
index = (a * B) + b;
For further dimensions it gets exponentially more complex and I'm on a bus..;D
But this technique could work for you.
LeKhris LeBeat me to LePost, but I don't LeCare. :P
Ah ok, I'll try those. Thanks :)