Get Edges from next room? [SOLVED]

Started by Knox, Sun 29/06/2014 22:10:17

Previous topic - Next topic

Knox

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?
--All that is necessary for evil to triumph is for good men to do nothing.

Crimson Wizard

No. There's no way to get anything from another room, because AGS only loads one room at a time.

Knox

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")?
--All that is necessary for evil to triumph is for good men to do nothing.

Crimson Wizard

#3
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

#define MAX_HOTSPOTS 50

<...>

  int i = 0;
  while (i < MAX_HOTSPOTS)
  {
    if (hotspot[i].GetTextProperty("Exit") == "Left")
    {
      hotspot[i].Enabled = false;
    }
    i++;
  }

Knox

Wow, that works great. Thanks! :smiley:
--All that is necessary for evil to triumph is for good men to do nothing.

Ghost

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

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

RoomEdges[SIZE] edges;


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


Knox

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!
--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk