referring to objects by name in global script

Started by GarageGothic, Wed 04/05/2005 15:25:50

Previous topic - Next topic

GarageGothic

I was wondering if there's any way of calling a room object by it's o-name in the global script? I have some code that I'd like to use for several rooms but only call for the ones where it's necessary. But of course AGS doesn't know where it will be used, so it fails to compile due to an unknown o-name referred.

I can use object
  • commands, but it would be easier if the object didn't have to have the same number for every room.

    I'm considering using a repeated GetName(object) at the start of every room script to compare the name and pass the object number to a global variable, but is there any easier way?

Pumaman

This is not easily possible to do. The easiest workaround is probably to put something in on_event(EnterRoom) to loop through all the objects in the room and do the GetName check.


SMF spam blocked by CleanTalk