Select Plugin Instance at Edit Time.

For developers using the Construct 2 Javascript SDK

Post » Wed May 14, 2014 12:25 pm

I am trying to create a Plugin [A] that lets you select an Instance of another Plugin [B].
I want to load all the instances of Plugin [B] into an ept_combo property of Plugin [A].
This ept_combo list would have to change dynamically inside the Edit Time when new Instances of [B] are created.
I have taken a look at this example http://c2plugins.blogspot.tw/2014/02/reuse-ace.html.
But it does not seem to work inside the Edit Time when I modified it for testing:
Code: Select all
var plugins = this.runtime.types;
var name, inst;
var PLUGIN_LENGTH = 0;
for (name in plugins)
{
    inst = plugins[name].instances[0];
    PLUGIN_LENGTH ++;
}
alert(PLUGIN_LENGTH);

^^^ Just Gives me Errors

To get a better understanding of the ept_combo I wrote this:
Code: Select all
var randomLength = Math.floor(Math.random() * (10 - 1) + 1);
var combo_array = "";
var combo_array_backup;
for(var i = 0; i < randomLength; i++ ) {
   combo_array_backup = combo_array + i + " |"
   combo_array = combo_array_backup;
}
combo_array = combo_array.substring(0, combo_array.length - 1);

var property_list = [
   new cr.Property(ept_combo,      "Canvas",       "0",    "Select the Canvas", combo_array)
   ];


Instead of a random number I need to have the amount of instances of [B] inside the ept_combo. And when new Instances of [B] are added then all instances of [A] need to update their ept_combo property accordingly.

Help! :shock:
B
40
S
11
G
4
Posts: 665
Reputation: 8,453

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests