piranha305's Forum Posts

  • If you are using the Array.json file, you will need an AJAX object to request that file, then use the AJAX objects LastData Property to Load the Array using the Array.Load Action

    here is an exmaple:

  • 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.

  • 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.

  • No the issue was related to the array filter for selecting which array to shuffle on the project, it was related to the plugin id which was arr not array.. I have fixed it and I will push that out later today.

  • download the plugin here: https://www.construct.net/make-games/addons/176/chance

    example project here : https://www.construct.net/make-games/addons/176/chance/examples/1/chance.c3p

    This plugin is based on https://chancejs.com/

    You can also get the plugins on my github page https://github.com/armandoalonso/C3Plugins

    Release Notes

    • 09/18/2018 - initial release,
    • 09/19/2018 - updated example project, and fixed bug with array selection
    • 09/23/2018 - finished implementing remaining expressions
  • 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?

  • 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?

  • Thanks I think that's a cleaner way

  • When u use a variadic parameter, it's still calling one expression. It just returning an array as a Param.

    So I would need to handle all the cases in that expression to account for all the Parameters I'm expecting.

    I guess if the max Param I'm expecting is 3 I can just ignore every other Param after that.

    As for documentation? Can u document the parameters? In a variadic function?

  • Is there a way to create Expression overloads??

    for example

    let's say i have 2 expressions Sum(a,b) and Sum(a,b,c)

    is there a way to have both of these expression share the same expressionName but have construct determine which one to use based on the number of param passed in? this is a very trivial example which we can use varadic param for? but i'm think of a more complex example which a varadic param cannot be used, i'm just wonder if there is a way to have the same expression name instead of having to add a separate name for each function?

  • Is it possible to have a container with multiple of the same object object type? i want to have a container that has 1 instance of Object A and 2 instances of Object B? is this possible?

  • Thank you

  • 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.

  • Quick question, so in order for the plugin to actually draw it has to be a "World" type plugin? is there a way to have a Single Global Plugin call the Draw function of the instance? SDKInstanceBase does not seem to have the Draw method where i can access the renderer, only SDKWorldInstanceBase.

    so for the plugin i'm creating it's currently a single global plugin, which holds an array of x,y coord, on every draw call i'm trying to draw a line between all points, but since it's currently extending from SDKInstanceBase the Draw method is not being called.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?