There was an old request to be able to access Room descriptions in script, and maybe number of rooms in game too.
I opened a PR for adding this to AGS 4.0:
https://github.com/adventuregamestudio/ags/pull/2626
But here's a issue: rooms are not sequential, and room list may have gaps in it.
Suppose I add following:
/// Gets the total number of the rooms in game.
static readonly attribute int Game.RoomCount;
/// Gets the room's name (description) by its index, returns null if such room does not exist.
static readonly attribute String Game.RoomNames[];
RoomCount returns the number of valid rooms in game.
If RoomNames[] is accessed by a room number, then it will have gaps in it.
If RoomNames[] will represent a sequence having only valid rooms, then you won't be able to tell which rooms are these.
If we leave the first variant, it will work easily to get a name for particular room by its number,
but it will make it more difficult to iterate,
and also RoomCount becomes ambiguous.
The only idea I had so far (besides leaving as it is), is to introduce a second array which stores numbers of valid rooms in a sequential array, like:
/// access sequentially 0 to RoomCount
static readonly attribute int Game.RoomNumbers[];
Then iterating over all valid rooms will be performed as:
for (int i = 0; i < Game.RoomCount; ++i)
{
String name = Game.RoomNames[Game.RoomNumbers[i]];
}
What do you think?
How is the list box filled when you call Debug(3. 0) (or press Ctrl+X)?
Quote from: Joacim Andersson on Thu 02/01/2025 14:10:43How is the list box filled when you call Debug(3. 0) (or press Ctrl+X)?
This is a built-in dialog that engine fills reading the room names from the game data.