Help with using the "object array" to access objects in the global script?

Started by pietakio, Wed 10/10/2012 19:38:05

Previous topic - Next topic

pietakio

Hello!

I am trying to use the Object.Name property in the global script to access an object's name string from any room.

I've looked around for an answer but can't figure out how to use the "Object array" that I've heard about.

Just wondering if anyone could tell me how it works?

I know the basic format is something like:

"object[2].Name"  and that objects are numbered in a room by an ID number, but how does the room number fit in with the object index if we're going for a general script call?

Any insights would be much appreciated.

Thanks!

geork

To the best of my knowledge, the objects accessed are the ones in the current room. Otherwise you've hit the nail on the head. You call
Code: AGS
object[i].Name //or whatever

where "i" is the index of the object and just use it as if it where a normal object. You may, however, never call
Code: AGS
oObjectName.Name

Where "oObjectName" is the name of the object, in the global script.

I don't think there is a way to call objects from a different room...

Hope that helps :)

Crimson Wizard

AGS does not allow to directly change anything in different Rooms, only in current one.
There could be a way to prepare certain changes by storing their data in a global array, and apply only when appropriate Room is loaded.

pietakio

Hello!

Thanks for your helpful replies. Knowing the limits I'll just try to do what I'm trying to do via the room script :)

All best,

Alexis

SMF spam blocked by CleanTalk