Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DannyV on Sat 05/01/2013 06:24:12

Title: how can I manipulate room objects with dialogs and character events?
Post by: DannyV on Sat 05/01/2013 06:24:12
I've searched a good while and for the life of me can't find this out, although I'm sure it's as basic as it gets.
I've caught on that when I'm outside of a room's code (like globalscript or a dialog), I can't manipulate objects for a room.  E.g.,  the following:

function cEgo_UseInv()
{
    oWall.Visible = false;
  }

returns the error: undefined token 'Wall'

I get that this isn't working because character functions aren't within the room, but what's the workaround?  Basically, how can I manipulate room objects with dialogs and character events?

Thanks so much, fellas.
Title: Re: how can I manipulate room objects with dialogs and character events?
Post by: Hernald on Sat 05/01/2013 06:54:55
You can do it be referencing the object's number. Do an if condition on the room number and say, for instance, object[3].Visible=false.
You might want to specify which inventory item this is for as well.
Title: Re: how can I manipulate room objects with dialogs and character events?
Post by: DannyV on Sat 05/01/2013 07:26:41
That did the trick.  Thank you, sir.  Just recognized that objects still retain IDs after being renamed.
Gracias again.