is it possible to have plugins communicate with other plugins?

0 favourites
  • Thank you

  • Is there a way we can get Access to the complete array data structure? with the dictionary version we can get the complete map? can we have the same thing for array? some like instance.GetArray() - / instance.SetArray(3darray) * this should probably also update the size based on the passed in array?

    so the reason i'm asking for this is, it seems like there if you needed to pass that array around to a 3rd party js lib? or some other js functions that take an array as a param i would first have to iterate the array and create a copy on the fly, then i pass it in to the whatever js function, have some operation on it which then returns the modified array, then in order to set the array back you have to then iterate one more time to then set each value separately.

    so i did a proof of concept, using an external js lib chancejs.com/helpers/shuffle.html pretty much takes an array as a param and spits a shuffled array (i mean i could write the shuffling logic myself in the plugin, but if i wanted to create a wrapper for an external lib this might be helpful);

    for(var i = 0; i<width; i++) {temp.push(instance.At(i,0,0));} var temp = this.chance.shuffle(temp); for(var i = 0; i<width; i++) {instance.Set(i,0,0,temp);}

    here is how the same logic can be done using the private reference to the array, which seems cleaner.

    here we are just replacing the array reference.

    var newArr = this.chance.shuffle(instance._arr); instance._arr = newArr;

    Is there any reason, why we can't have access to proper array data structure?

  • Ashley

    I think i found a bug with the allowedPluginIds, i wanted to post it here before i file a report just to make sure this is not the expected behavior, So the allowedPluginIds and the object picker work perfect when there is one instance of an array. i was able to specify the instance and i was able to modify that particular instance,

    now when i added a second array and tried to run the same action on it, the item filter came up empty, see image below.

    so the reason i'm not sure if this is a bug is, when you filter by an object type your not really selecting it's instance, in this case the array is a global plugin but there are multiple objects for the same object class. is this expected or should we see the second array in that list? or even the first one ? what if i wanted to perform the same operation on the same array twice? i feel likes it's a bug

    this is my action def i'm using

    { "id": "array-shuffle-1d", "scriptName": "ShuffleArray", "params": [ {"id": "arr", "type": "object", "allowedPluginIds": ["Array"]} ]}

    should i file this a a bug?

  • The Array plugin internally maintains a 3D array at all times, even if it's only used 1-dimensionally. This means it's neither much use to expose it directly (since few libraries expect a 3D array), nor is it convenient for calling code to have to worry about maintaining the right structure of the array. So it exposes several accessor methods that allow you complete control over the array but guarantee you can't mess up the structure. So just use these to flatten to a 1D array or whatever else you want to do.

    The Array plugin ID is "Arr" not "Array".

  • This works really well, thanks for the quick implementation of this stuff! could the next plugin you look at when you have time be the Tile Map plugin? i know that's a big plugin, but maybe add it to the backlog, things like being able to set cells and get cells also get width/height and alter the tile state, would be useful. this would be pretty neat for procedural generation of tile maps where the plugin can hold the data structure and then apply it to the tile map without having to do it through the event system.

  • I'll take a look at that soon.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've added some basic APIs for the Tilemap plugin: https://www.construct.net/make-games/manuals/addon-sdk/runtime-reference/addon-interfaces/tilemap

    Note they're documented but won't all work until the next release.

  • That really great! Thanks, man you guys are fast. I will start working on the plugin I had in mind, and then test it with the next beta release.

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