Scripting Containers

0 favourites
  • 3 posts
  • Hi Ashley,

    Will there be a Scripting API for containers, to be able to reference them? A sample use-case is setting all containers with an instance variable of the uid of the parent object, upon creation.

    Also, other interactions as well.

    I've tried picking the objects by manual name search (runtime.objects["name"]), however it seems that the container objects are only later created after the "instancecreate" event. So, it's not possible to reference them on creation, unlike events.

    Thanks.

  • Will there be a Scripting API for containers, to be able to reference them? A sample use-case is setting all containers with an instance variable of the uid of the parent object, upon creation.

    It's not currently supported. It's best to log suggestions at construct3.ideas.aha.io so they don't get lost in the forum.

    FWIW, containers are pretty straightforward: because they always create and destroy together, all instances have the same IID (i.e. the same index in the instance lists), so you should already be able to figure out the container instances fairly easily.

    I've tried picking the objects by manual name search (runtime.objects["name"]), however it seems that the container objects are only later created after the "instancecreate" event. So, it's not possible to reference them on creation, unlike events.

    It's impossible to reference all container instances in a create event, due to the reasons I explained here.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • FWIW, containers are pretty straightforward: because they always create and destroy together, all instances have the same IID (i.e. the same index in the instance lists), so you should already be able to figure out the container instances fairly easily.

    Oh right, I never thought about that, that's a great tip.

    Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)