Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: KingMick on Tue 04/01/2005 18:01:53

Title: Accessing Objects from a different room
Post by: KingMick on Tue 04/01/2005 18:01:53
I am wondering if there is a way in AGS to access an object in one room from a script in another room--i.e. a way to retrieve the values of the object's custom properties.  I see many uses for this ability but looking through the Help files cannot find a way to do it.  Can anyone tell me if this is possible?
Title: Re: Accessing Objects from a different room
Post by: Pumaman on Tue 04/01/2005 18:20:10
No, you can only access objects in the current room.

Trying to access them would be very slow, since AGS would have to load the other room file, extract the relevant data, and then close it again, which would be noticably time-consuming.
Title: Re: Accessing Objects from a different room
Post by: Goot on Wed 05/01/2005 03:06:35
You can still do it though. Set a global variable for the object and then in player enters room before fade in, for that room, put:
if(GetGlobalInt(x)==1){
ObjectOn(x);
}
else{
ObjectOff(x);
}

I think there's also a plugin for it somewhere.