is it possible to have plugins communicate with other plugins?

0 favourites
  • like for example: lets say i have a plugin and one of the action has a param of type object, is there a way to only select object of a specific type like "ARRAY" or "SPRITE"

    and then in the implementation is there a way to access the properties of that given object,

    Like i'm thinking of like creating "ADDON Extensions", like for example lets say i wanted to extend the array plugin to have a randomize function like a specific implementation of a shuffle,

    Instead of recreating an array plugin with those actions, i want to have an ArrayExtention plugin which has property of type object that point to an existing Array Object. and have my actions manipulate it's data?

    Ashley Is there currently a way to do this?

  • It's possible, and a much better idea than the compatibility nightmares caused by the "copy and paste a whole addon then tweak it" approach to addon development. Adding a plugin type filter to the object type parameter would be a good start. However it would mean documenting public interfaces for every kind of addon, and then being obligated to support those APIs forever, which could potentially limit what code changes we can make in future. Maybe we could keep the APIs really small though, like for array, just a method to directly access the main array in use.

  • Okay I see, so right now what is exposed when you get that object as a Param? Does that get you the specific instance of the object or just the class?

  • It gives you the ObjectType, from which you can get any of its instances.

  • Can't use also use the plug-ins interface by plugin version.. So the plugin extending can have the max version supported of the plugin type its extending and then there would not be breaking changes to the interface until the extension plugin is updated...? It should behave like every thing else that has dependency... Like npm in the package json you prefix your library with a version and that's the one your project support...

  • I think that's more complicated than just committing to support a particular API.

  • Okay, would it be possible to add some documentation (when you have some extra time) on how to get that the instances from the ObjectType

    The IObjectType interface does not have a method to pull the instances unless I'm looking in the wrong olace

  • It's already there.

  • Okay cool I was looking at the wrong place thanks

  • So i'm at the point where i am getting the Array Instance, but i'm not sure how to access the properties of that array instance?

    So i'm logging back the correct object, just not sure where to get the property i'm looking for? I checked the documentation for the ObjectClass and can't really see where that would be?

    there is the savedData map but that null, the instVar arrays are also null? so i'm not really sure how the array plugin is implemented, but i know that the instance should at least have a savetoJson and loadFromJson method, if i can't directly access the array data i'm thinking maybe i can parse it's json do my work then save the json back to the array plugin, not really if that extra over head of parsing the json and writing it back will have a negative impact.

    but either way i'm not sure where i can call those methods on the instance?

  • so I was able to access the arrays data using GetSdkInstance() there is an _arr property on that object, i'm guessing this is not recommend since the arr property is prefixed with an Underscore. what is the accepted pattern to access that array value?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is where we would need to write and document public APIs for addons to use.

  • okay so addon owner would need to expose whatever property to make it extensible. i think there is alot of value in exposing some of these property to some of the built in addons, currently i have only been dealing with the array plugin, but i see where this type of thing can be very useful for some of the other plugin types, what i will do is, when i stumble onto a property i think might be beneficial i will add a suggestion for it, in the idea portal, then you guys could let me know if its possible or not! the new c3 runtime api is very clean! great stuff.

    ohhh... one more question before i stop bother you! is there a way to invoke actions / expressions from the that instance? in a plugin do i have access to Cnd,Act,Exp where would those objects be? or are those kept private?

  • I saw the changes made to the documentation for the Array And Dictionary API, this is very cool stuff! on the array there is SetSize(w, h, d) is it possible to also get GetSize methods either one GetSize which would return the array of sizes [w,h,d] or a GetWidth(), GetHeight(), GetDepth(), just some type of way to pull that data to make iterating easier since we don't have access to the actual array reference to get length.

  • Good point, missed those - will add for next release.

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