Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Catacomber on December 24, 2008, 06:35:09 PM

Title: How address a container entity
Post by: Catacomber on December 24, 2008, 06:35:09 PM
I know how to load and access a normal button, static and nested window and am experimenting now with container entities held by a window.

How do you address (access) a container entity held in a window?

After I insert a container entity in a window and link it to a sprite, if I try to load the window it's in in game.script this way (there's a global contwin; in base.inc--contwin is the name of the window; container is the name of the container; ent is the name of the sprite entity that the container holds):

Code: WME Script
  1. contwin = Game.LoadWindow("scenes\contwin.window");
  2. contwin.Visible = true;
  3. var c = contwin.GetControl("container");
  4. var ent = contwin.GetEntity("ent");
  5.  

I get a black screen and freeze.

Also to refer to the sprite entity held in the container, do you have to put its path or just its name?

And lastly--can you put a container entity that holds a sprite inside a static and access it--then how would you access that?

Any help is appreciated.  :  )
Title: Re: How address a container entity
Post by: Mnemonic on December 24, 2008, 08:52:42 PM
It should look like this:
Code: WME Script
  1. contwin = Game.LoadWindow("scenes\contwin.window");
  2. contwin.Visible = true;
  3. var c = contwin.GetControl("container");
  4. var ent = c.GetEntity();
  5.  

You need to ask the container to give you the entity it contains.
Title: Re: How address a container entity
Post by: Catacomber on December 24, 2008, 09:22:18 PM
Thanks, Mnemonic.  :)