how can I manipulate room objects with dialogs and character events?

Started by DannyV, Sat 05/01/2013 06:24:12

Previous topic - Next topic

DannyV

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.

Hernald

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.

DannyV

That did the trick.  Thank you, sir.  Just recognized that objects still retain IDs after being renamed.
Gracias again.

SMF spam blocked by CleanTalk