Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Sun 29/06/2014 22:10:17

Title: Get Edges from next room? [SOLVED]
Post by: Knox on Sun 29/06/2014 22:10:17
Hi,

I was wondering if there was a way to query the room edges the player is about to enter?

For example, say the player is currently in RoomA. The player walks over an exit region in RoomA to go to RoomB, but before that player actually goes to RoomB, I'd like to save RoomB's edges from within RoomA as global variables so I can use them in a custom changeroom function.

Is this possible somehow?
Title: Re: Get Edges from next room?
Post by: Crimson Wizard on Sun 29/06/2014 22:14:12
No. There's no way to get anything from another room, because AGS only loads one room at a time.
Title: Re: Get Edges from next room?
Post by: Knox on Sun 29/06/2014 23:40:15
Aww crap.

Ok, well on another note, how can we loop through all the current room's hotspots and disable only the ones that have a certain text property value (GetTextProperty("Exit") == "Left")?
Title: Re: Get Edges from next room?
Post by: Crimson Wizard on Mon 30/06/2014 00:11:43
Quote from: Knox on Sun 29/06/2014 23:40:15
Ok, well on another note, how can we loop through all the current room's hotspots and disable only the ones that have a certain text property value (GetTextProperty("Exit") == "Left")?

Code (ags) Select

#define MAX_HOTSPOTS 50

<...>

  int i = 0;
  while (i < MAX_HOTSPOTS)
  {
    if (hotspot[i].GetTextProperty("Exit") == "Left")
    {
      hotspot[i].Enabled = false;
    }
    i++;
  }
Title: Re: Get Edges from next room?
Post by: Knox on Mon 30/06/2014 00:31:44
Wow, that works great. Thanks! :smiley:
Title: Re: Get Edges from next room? [SOLVED]
Post by: Ghost on Mon 30/06/2014 00:40:02
Quote from: Knox on Sun 29/06/2014 22:10:17
I was wondering if there was a way to query the room edges the player is about to enter?

If you don't have too many rooms, you could create a struct to hold edge position and then an array, populating it with the proper values during game_start. You'd have to enter the values manually, but if you plan to use that custom function of yours a lot, it could be worth the effort.

Basically:
Code (AGS) Select

struct RoomEdges
{
  int top,
  int left,
  int bottom,
  int right,
};

RoomEdges[SIZE] edges;


Not a NICE way of doing it, but a workaround.

Title: Re: Get Edges from next room? [SOLVED]
Post by: Knox on Wed 02/07/2014 00:49:59
Hi Ghost,

Im not too sure how many rooms I will eventually have, but there is already quite a few. I plan on using it for pretty much all the rooms...I like the workaround though, pretty clever. Entering the values manually shouldn't be too much of a hassle.

Thanks!