[Plugin] Data structures in associative lists

0 favourites
From the Asset Store
Sci-fi structures
$10.50 USD
30% off
Structures, platforms & turrets for spaceshooters,towerdefense or sci-fi game
  • Hi all !

    I used my spare time at work to mess around with the plugin SDK. I decided to give a go at data structures and this little plugin was born !

    I basically implemented the basic JavaScript's array functions (pop, shift, splice, etc.) for vectors, with all vectors stored in an associative list. Actions add data, and expressions remove it, although you can still remove data with an action (but without retrieving it).

    Descriptions, names and such are a mess, but I think it's still pretty usable. If someone feels like cleaning the descriptions and giving more significative names to conditions, actions and expressions, or even adding more functionalities to the plugin, please do ! I did this just for kicks, but if it can be helpful for someone, then by all means use it !

  • Wow, I totally overlooked this. And was actually about to try my hand at a plugin with the exact same functionality!

    This is very helpful indeed, one of the things I was missing in C2 so far the most. I agree that some of the names/descriptions could be more intuitive for users that don't know the actual javascript terminology. Maybe I'll do something about that.

    Very well done, thanks for this!

  • No go in r62.:(

  • What "recently" changed in the SDK ? Recently being between r55 and the current one.

  • It seems to work fine with current C2 versions if you edit the runtime.js a little.

    Search for all occurences of "cr.plugins" and add an underscore, so it'll be "cr.plugins_". I think it just appears four times at the beginning of the file.

  • Nice. Works like a charm now.


  • Glad to hear that ! <img src="smileys/smiley20.gif" border="0" align="middle" />

  • Magistross, do you have a quick example you could post showing how to use this plugin?

  • There you go !

    I cooked this up in a hurry. Most of the functionnalities can be tested. It's all pretty basic, but might seem a bit hard to grasp if you're new to all this popping and shifting.

    Note that you need to add data with push or unshift before you can do anything. (Inserting at index 0 in an empty data structure won't cut it)

  • Thank you, sir! This is exactly what I needed for a current project.

  • Hi All,

    First of all hello, my name is Bhavan, I have just purchased Construct 2 and starting to play around with some of its features (plugins etc.)

    Congratulations to you all for having an excellent forum. I have been finding it very helpful in the short period I have been using C2.


    There is some strange behavior I began to notice. I tried using the Array (array plugin) and something really simple, (such as adding a value, and retrieving it) seems to simply not work. (always retrieves 0, which I have read is the value when you go out of bounds)

    So, I arrived here, thinking must be a bug in the plugin, and this plugin provides similar behavior (i required a 1D array). So I downloaded data structures, made the cr.plugins_ change as posted in one of the replies here (runtime.js) to avoid an assert, and guess what, some simple push, pop still retrieves 0. (On a side note, one of the other plugins I installed too, "function" does not work, but here I think my usage is incorrect, so not sure of this yet.)

    So I downloaded the example you have posted above, and opened it up in C2, and hey, the stuff works. I replicated the simple push, at() behavior I had in my project in the example project, and this too worked!

    So I cannot see what I am missing, I am not aware of what difference a .capx and .caproj makes (mine is .caproj, the example is a .capx). Maybe I made a mistake while installing the plugin?

    Any hints will be appreciated, I will upload my .caproj if required. But I think this may be trivial.

  • Maybe you're using bracket notation?

    such as array[1][2]

    if so, it isn't the proper way to use arrays.

    You should use it as array.at(1,2)

    Also, arrays are zero based, and no dimensions should have size zero. If you want a two dimensional array, Z should be 1.

    Without seeing your caproject, I can't say.

  • Yes yes,

    I know..

    I am really sorry about not posting the project file.

    Ok.. So. Forgive me for not following protocol for I am new.

    Next time will be posting the project file.


    So I first ran into this..


    And realized this must have occurred before..

    So found this:


    And this is exactly whats wrong.

    The new object has to be inserted with a layout selected.

    I believe no "instance" is created otherwise..

    Umm. How can I attach a project file to this post? only URLs?

    Maybe it can be helpful to reproduce this..


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK, So I downloaded this little plugin to view an example CAPX for maze creation. However with r80.2 I am getting

    Assertion failure: cr.plugins not created

    Stack trace:

    assert2((void 0),"cr.plugins not created")@http://localhost:50000/preview_prelude.js:12


    Any Ideas? (I placed the folder in the Plugins folder...)

  • Zetar

    Might want to read over the thread a bit PR gave a fix.

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